Disable AWS search logic
August 7, 2025 Β· AI Conversations
$page_id = get_queried_object_id();
if(get_field('is_hide_instant_search',$page_id)){
$is_hide_instant_search = get_field('is_hide_instant_search',$page_id);
} else {
$is_hide_instant_search = 0;
}
if ( get_post_type() === 'lp' || $is_hide_instant_search == 1 ) {
return;
}
How to apply above condition in Advanced Woo Search PRO
– When post type is `lp`
– When a custom field `is_hide_instant_search` is set to true (1)
Advanced Woo Search PRO allows for some customization via hooks and filters. Here's how you can apply the logic.
—
### β Step-by-Step Implementation
#### 1. **Use the `aws_is_search_enabled` Filter**
Advanced Woo Search PRO provides this filter:
add_filter( 'aws_is_search_enabled', 'custom_disable_aws_on_specific_pages' );
You can use your logic inside this function to **disable search** where needed.
—
### β Full Code:
add_filter( 'aws_is_search_enabled', 'custom_disable_aws_on_specific_pages' );
function custom_disable_aws_on_specific_pages( $enabled ) {
if ( is_admin() ) {
return $enabled; // Keep it enabled in admin
}
$page_object = get_queried_object();
$page_id = get_queried_object_id();
$post_type = get_post_type();
$is_hide_instant_search = get_field('is_hide_instant_search', $page_id); // ACF field
if ( $post_type === 'lp' || $is_hide_instant_search == 1 ) {
return false; // Disable search on this page
}
return $enabled;
}
—
### π Where to Put This Code?
Add this to your themeβs `functions.php` file or a custom plugin.
—
### π What It Does
– Checks the current post type.
– Checks if ACF field `is_hide_instant_search` is set.
– Disables the **instant search** from appearing on pages matching your condition.
—
Let me know if you're using a **shortcode or widget**, or if you need to **hide the search bar itself**, not just the live search results β the approach will vary slightly.
aws_searchpage_enabled
—
### β Goal
You want to **disable the Advanced Woo Search on the search results page** under two conditions:
1. If the current post type is `lp`
2. If the ACF field `is_hide_instant_search` is set to `1` on the current page
—
### β Use the `aws_searchpage_enabled` Filter
This filter controls whether **Advanced Woo Search** modifies the default search results page.
—
### β Code Implementation
add_filter( 'aws_searchpage_enabled', 'custom_aws_disable_search_results_page' );
function custom_aws_disable_search_results_page( $enabled ) {
if ( is_admin() ) {
return $enabled;
}
$page_id = get_queried_object_id();
$post_type = get_post_type();
// Check ACF field (will be false if not set)
$is_hide_instant_search = get_field('is_hide_instant_search', $page_id);
if ( $post_type === 'lp' || $is_hide_instant_search == 1 ) {
return false; // Disable Advanced Woo Search on search page
}
return $enabled;
}
—
### π Explanation
– `aws_searchpage_enabled` runs on the search results page to determine if AWS should take over.
– You use your custom ACF condition and post type check.
– If either condition is met, AWS will **not override** the default search page.
—
### β
Bonus: Disable Only for Certain Page IDs
If you want to limit this further to specific page templates or IDs:
if ( is_page(123) || $post_type === 'lp' || $is_hide_instant_search == 1 ) {
return false;
}
—
Let me know if you also want to apply this logic to the **instant (AJAX) search dropdown** β that uses a different filter (`aws_is_search_enabled`).
add_filter( 'aws_searchpage_enabled', 'pmmv1_aws_disable_search_results_page' );
function pmmv1_aws_disable_search_results_page( $enabled ) {
if ( is_admin() ) {
return $enabled;
}
$page_object = get_queried_object();
$page_id = get_queried_object_id();
if(get_field('is_hide_instant_search',$page_id)){
$is_hide_instant_search = get_field('is_hide_instant_search',$page_id);
} else {
$is_hide_instant_search = 0;
}
if ( get_post_type() === 'lp' || $is_hide_instant_search == 1 ) {
return false;
}
return $enabled;
}
—
### β Quick Fix: Avoid Calling `get_queried_object()` Too Early
You should delay the logic until **the main query is available**. Instead of using `get_queried_object()`, check `is_search()` and safely use `get_post_type()` **only if in the loop or when it's safe**.
—
### β Recommended Solution Using `get_query_var()` Instead
add_filter( 'aws_searchpage_enabled', 'pmmv1_aws_disable_search_results_page' );
function pmmv1_aws_disable_search_results_page( $enabled ) {
if ( is_admin() || !is_search() ) {
return $enabled;
}
global $wp_query;
// Safely get page ID and post type
$page_id = get_query_var('page_id') ?: get_queried_object_id();
// Avoid triggering ACF if no valid page ID
$is_hide_instant_search = $page_id ? get_field('is_hide_instant_search', $page_id) : 0;
// Use global post type fallback
$post_type = get_query_var('post_type');
if ( is_array( $post_type ) ) {
$post_type = reset( $post_type );
}
if ( $post_type === 'lp' || $is_hide_instant_search == 1 ) {
return false;
}
return $enabled;
}
—
### β Alternative Safe Approach (Delay Using `template_redirect`)
If things still fail, move the ACF logic to a later hook like `template_redirect`, store a global flag, and return it in the filter.
—
### π‘ Summary
– Avoid `get_queried_object()` and `get_queried_object_id()` in early-phase filters like `aws_searchpage_enabled`.
– Use `get_query_var()` or delay logic to a later hook.
– Always check that the `page_id` is valid before calling ACF functions.
Let me know if you'd like to extend this logic to the **instant AJAX search** as well.
function my_aws_searchpage_enabled( $is_enabled, $query ) {
if ( isset( $_GET['aws_off'] ) && $_GET['aws_off'] === 'true' ) {
return false;
}
return $is_enabled;
}
adjust in above
—
### β Final Working Code
add_filter( 'aws_searchpage_enabled', 'my_aws_searchpage_enabled', 10, 2 );
function my_aws_searchpage_enabled( $is_enabled, $query ) {
if ( is_admin() || ! $query->is_main_query() ) {
return $is_enabled;
}
// Optional manual override via ?aws_off=true
if ( isset( $_GET['aws_off'] ) && $_GET['aws_off'] === 'true' ) {
return false;
}
// Avoid infinite loop by checking if it's a search query
if ( $query->is_search() ) {
// Get queried object ID safely (only if it's a page or post)
$page_id = get_queried_object_id();
$is_hide_instant_search = $page_id ? get_field( 'is_hide_instant_search', $page_id ) : 0;
// Try to get post type from query var
$post_type = $query->get( 'post_type' );
if ( is_array( $post_type ) ) {
$post_type = reset( $post_type );
}
if ( $post_type === 'lp' || $is_hide_instant_search == 1 ) {
return false;
}
}
return $is_enabled;
}
—
### β Why This Works
– `$query` gives you the actual `WP_Query` object (so you donβt need `get_queried_object()` which causes recursion).
– `get_field()` is only called if a valid page ID exists, avoiding unnecessary errors.
– You still support your `?aws_off=true` override.
– This version prevents **maximum stack depth recursion** and works cleanly with AWS PRO.
—
Let me know if you also want to **disable the instant dropdown (AJAX)** using `aws_is_search_enabled` with the same logic.
<style>
.insta-search-results{display:none;z-index:999999;background-color:#fff;position:absolute;right:0;width:100%;border:none;border-bottom:1px solid #cacaca}
@media (min-width:768px){.insta-search-results{width:600px;border:1px solid #cacaca;border-top:none}}
@media (min-width:981px){.insta-search-results{position:absolute;right:152px}}
.insta-search-results li{width:100%;display:inline-block;list-style:none;}
.search-listing{padding:3px 10px;}
.search-product{vertical-align:top;}
.insta-search-results img{float:left;margin-right:5px;}
.search-listing a{text-transform:uppercase;font-size:13px;display:block;min-height:60px;color:#666;}
.search-listing .amount, .search-listing .woocommerce-Price-currencySymbol{color:#666;}
.search-name{padding:0;font-weight:700;line-height:normal}
.insta-search-results .woocommerce-Price-amount.amount{font-weight:700}
.search-heading{text-transform:uppercase;background-color:#f8f8f8;color:#999;font-weight:700;font-size:12px;padding:0 10px;border:1px solid #eaeaea}
.search-footer{margin:0;}
.search-footer a {color:#999;}
.search-listing:hover{background: #f2f2f2;}
.search-listing:hover a,.search-listing:hover .amount,.search-listing:hover .woocommerce-Price-currencySymbol {color: #08c;}
</style>
<script>
jQuery(document).ready(function($) {
function setResultsPos() {
//var scrollPos = $(window).scrollTop();
var searchPos = $('.et_search_form_container').offset().top + $('.et_search_form_container').outerHeight();
//var resultsPos = searchPos + scrollPos;
$('.insta-search-results').css("top", searchPos + "px");
}
//When the search box is clicked, set the position of the results element
$('.et-search-field').on('click', function(){
setResultsPos();
});
//Set position of the results element on first keypress
$('.et-search-field').one('keyup', function(){
setResultsPos();
});
$(window).on('resize', function(){
setResultsPos();
});
//Close search results when the close search X button is clicked
$('.et_close_search_field').on('click', function(){
if ( $('.insta-search-results').is(':visible') ) {
$('.insta-search-results').slideUp();
}
});
//Close search results on clicking away from search or results element
$(document).on('click', function(event){
if ( !$(event.target).closest('.insta-search-results').length && !$(event.target).closest('.et-search-form').length ) {
$('.insta-search-results').slideUp();
}
});
$('.et-search-field').on('keyup', function(){
//empty the results
$('.insta-search-results').html('');
if ( $(this).val() !== '' && $(this).val().length > 1 ) {
//get the search term, and lowercase it
var searchTerm = $(this).val().toLowerCase();
//construct regex
var reSearch = new RegExp('\b' + searchTerm, 'gi');
var foundSomething = false;
var foundProducts = 0;
var foundCats = 0;
//loop through the products and search
$('#pmm-instant-search li').each(function(){
var searchData = $(this).data('search').toLowerCase();
if ( searchData.search(reSearch) > -1 ) {
foundSomething = true;
if ( $(this).data('type') === 'product' ) {
foundProducts++;
if ( foundProducts > 4 ) {
return true;
}
} else {
foundCats++;
if ( foundCats > 4 ) {
return true;
}
}
var displayProduct = $(this).clone();
var imgUrl = displayProduct.data('image-url');
var prodUrl = displayProduct.data('product-url');
var prodDiv = displayProduct.children('.search-product');
prodDiv.prepend('<img src="' + imgUrl + '" width="60" height="60">');
prodDiv.wrap('<a href="' + prodUrl + '"></a>');
displayProduct.appendTo('.insta-search-results');
}
});
if ( foundSomething ) {
if ( foundProducts ) {
$('.insta-search-results').prepend('<li class="search-heading">Products</li>');
}
if ( foundCats ) {
$('.search-listing[data-type="category"]').eq(0).before('<li class="search-heading">Categories</li>');
}
$('.insta-search-results').append('<li class="search-heading search-footer"><a href="#" onclick="jQuery('.et-search-form').submit();">See More Results</a></li>');
} else {
$('.insta-search-results').html('<li style="padding:10px;">Sorry, no results found.</li>');
}
if ( !$('.insta-search-results').is(':visible') ) {
$('.insta-search-results').slideDown();
}
} else {
setTimeout(function(){
if ( $('.et-search-field').val().length < 2 ) {
$('.insta-search-results').slideUp();
}
}, 50);
}
})
});
</script>
<style>
.insta-search-results{display:none;z-index:999999;background-color:#fff;position:absolute;right:0;width:100%;border:none;border-bottom:1px solid #cacaca}
@media (min-width:768px){.insta-search-results{width:600px;border:1px solid #cacaca;border-top:none}}
@media (min-width:981px){.insta-search-results{position:absolute;right:152px}}
.insta-search-results li{width:100%;display:inline-block;list-style:none;}
.search-listing{padding:3px 10px;}
.search-product{vertical-align:top;}
.insta-search-results img{float:left;margin-right:5px;}
.search-listing a{text-transform:uppercase;font-size:13px;display:block;min-height:60px;color:#666;}
.search-listing .amount, .search-listing .woocommerce-Price-currencySymbol{color:#666;}
.search-name{padding:0;font-weight:700;line-height:normal}
.insta-search-results .woocommerce-Price-amount.amount{font-weight:700}
.search-heading{text-transform:uppercase;background-color:#f8f8f8;color:#999;font-weight:700;font-size:12px;padding:0 10px;border:1px solid #eaeaea}
.search-footer{margin:0;}
.search-footer a {color:#999;}
.search-listing:hover{background: #f2f2f2;}
.search-listing:hover a,.search-listing:hover .amount,.search-listing:hover .woocommerce-Price-currencySymbol {color: #08c;}
</style>
<script>
jQuery(document).ready(function($) {
function setResultsPos() {
//var scrollPos = $(window).scrollTop();
var searchPos = $('.et_search_form_container').offset().top + $('.et_search_form_container').outerHeight();
//var resultsPos = searchPos + scrollPos;
$('.insta-search-results').css("top", searchPos + "px");
}
//When the search box is clicked, set the position of the results element
$('.et-search-field').on('click', function(){
setResultsPos();
});
//Set position of the results element on first keypress
$('.et-search-field').one('keyup', function(){
setResultsPos();
});
$(window).on('resize', function(){
setResultsPos();
});
//Close search results when the close search X button is clicked
$('.et_close_search_field').on('click', function(){
if ( $('.insta-search-results').is(':visible') ) {
$('.insta-search-results').slideUp();
}
});
//Close search results on clicking away from search or results element
$(document).on('click', function(event){
if ( !$(event.target).closest('.insta-search-results').length && !$(event.target).closest('.et-search-form').length ) {
$('.insta-search-results').slideUp();
}
});
$('.et-search-field').on('keyup', function(){
//empty the results
$('.insta-search-results').html('');
if ( $(this).val() !== '' && $(this).val().length > 1 ) {
//get the search term, and lowercase it
var searchTerm = $(this).val().toLowerCase();
//construct regex
var reSearch = new RegExp('\b' + searchTerm, 'gi');
var foundSomething = false;
var foundProducts = 0;
var foundCats = 0;
//loop through the products and search
$('#pmm-instant-search li').each(function(){
var searchData = $(this).data('search').toLowerCase();
if ( searchData.search(reSearch) > -1 ) {
foundSomething = true;
if ( $(this).data('type') === 'product' ) {
foundProducts++;
if ( foundProducts > 4 ) {
return true;
}
} else {
foundCats++;
if ( foundCats > 4 ) {
return true;
}
}
var displayProduct = $(this).clone();
var imgUrl = displayProduct.data('image-url');
var prodUrl = displayProduct.data('product-url');
var prodDiv = displayProduct.children('.search-product');
prodDiv.prepend('<img src="' + imgUrl + '" width="60" height="60">');
prodDiv.wrap('<a href="' + prodUrl + '"></a>');
displayProduct.appendTo('.insta-search-results');
}
});
if ( foundSomething ) {
if ( foundProducts ) {
$('.insta-search-results').prepend('<li class="search-heading">Products</li>');
}
if ( foundCats ) {
$('.search-listing[data-type="category"]').eq(0).before('<li class="search-heading">Categories</li>');
}
$('.insta-search-results').append('<li class="search-heading search-footer"><a href="#" onclick="jQuery('.et-search-form').submit();">See More Results</a></li>');
} else {
$('.insta-search-results').html('<li style="padding:10px;">Sorry, no results found.</li>');
}
if ( !$('.insta-search-results').is(':visible') ) {
$('.insta-search-results').slideDown();
}
} else {
setTimeout(function(){
if ( $('.et-search-field').val().length < 2 ) {
$('.insta-search-results').slideUp();
}
}, 50);
}
})
});
</script>
<script>
jQuery(document).ready(function($) {
var data = {
action: 'load_serchdata',
//whatever: 1234
};
jQuery.post(ajaxurl, data, function(response) {
jQuery('#pmm-instant-search').html(response);
});
});
</script>
—
## π **What does `csis_load_insta_search_product_list2()` do?**
### β **1. Checks if the instant search should be shown on the current page**
$page_id = get_queried_object_id();
$is_hide_instant_search = get_field('is_hide_instant_search',$page_id);
if ( get_post_type() === 'lp' || $is_hide_instant_search == 1 ) {
return;
}
– This ensures that:
– The search bar does **not load** on **Landing Pages** (`post_type = lp`)
– Or if the ACF field `is_hide_instant_search` is set to `1` for the page
– If either condition is met, the function **exits early** and doesnβt load the search UI.
—
### β **2. Outputs the Instant Search HTML Containers**
<div class="insta-search-results"></div>
<div id="pmm-instant-search" hidden style="display:none;"></div>
– These “ containers are used to dynamically display:
– `.insta-search-results`: The visible dropdown of search results
– `#pmm-instant-search`: A hidden HTML container that will hold all product and category list items for JS-based searching
—
### β **3. Injects CSS for the Instant Search Results Styling**
The “ tag includes a large block of CSS that:
– Styles the instant search dropdown UI (`.insta-search-results`)
– Formats the product/category list items
– Adds hover states and responsiveness for desktop and mobile
—
### β **4. JavaScript: Sets Up Dynamic Positioning and Search Behavior**
There are **two jQuery scripts**:
#### πΈ Script #1: UI Behavior and Filtering
Handles:
– **Positioning** of the search result dropdown under the search input
– **Event bindings** to open/close the result dropdown
– **Real-time filtering** of preloaded products/categories based on input text
– **Cloning matching results** into `.insta-search-results`
– Displays headings: "Products", "Categories"
– Adds a "See More Results" link (which submits the search form)
#### πΈ Script #2: Load Search Data via AJAX
var data = {
action: 'load_serchdata'
};
jQuery.post(ajaxurl, data, function(response) {
jQuery('#pmm-instant-search').html(response);
});
– Sends a request to `admin-ajax.php?action=load_serchdata`
– Appends the returned HTML (a list of products/categories) into `#pmm-instant-search`
– This ensures the search dataset is loaded **once via AJAX**, not on every keypress
—
### β **5. AJAX Callback: `load_serchdata_callback()`**
This function handles the AJAX call from the script above:
– Gets all **published WooCommerce products**
– Sorts them by **sales volume**
– Outputs a list of “ items with:
– `data-search` attributes containing the product name + synonyms + categories
– `data-type`, `data-image-url`, and `data-product-url` for rendering
– Also loads **product categories** similarly
—
## π Summary
| Section | Purpose |
|——————————-|———|
| `get_field('is_hide_instant_search')` | Conditionally disables the feature on specific pages |
| `#pmm-instant-search` | Holds all search data (products + categories) |
| `.insta-search-results` | Visible UI dropdown for matched results |
| jQuery (script #1) | Listens for input, filters and displays matches |
| jQuery (script #2) | Loads the full list of searchable items via AJAX |
| `load_serchdata_callback()` | Returns “ items of products and categories |
—
### β
Result:
You're building a **custom instant search dropdown** (independent of Advanced Woo Search) that uses client-side JS + backend data preparation for **fast keyword matching** and shows results with images, links, prices, and synonyms.
Let me know if you'd like to connect this logic with Advanced Woo Search or replace AWS with this entirely.
– The current post type being `lp`, or
– The ACF field `is_hide_instant_search` being `1`
βyou need to **disable Advanced Woo Search PRO's UI** on those pages by using the filter it provides for the instant search dropdown:
—
### β Use This Filter: `aws_is_search_enabled`
This controls whether the **instant search UI (AJAX results dropdown)** should show up.
—
### β Final Code for Your `functions.php` or Custom Plugin:
add_filter( 'aws_is_search_enabled', 'disable_aws_ui_on_custom_conditions' );
function disable_aws_ui_on_custom_conditions( $enabled ) {
if ( is_admin() ) {
return $enabled;
}
// Ensure we're on a frontend page
if ( function_exists('get_queried_object_id') ) {
$page_id = get_queried_object_id();
// Avoid errors if ACF isn't available
$is_hide_instant_search = function_exists('get_field') && $page_id ? get_field('is_hide_instant_search', $page_id) : 0;
$post_type = get_post_type();
if ( $post_type === 'lp' || $is_hide_instant_search == 1 ) {
return false; // π΄ Disable AWS UI on these pages
}
}
return $enabled; // β
Enable normally
}
—
### β Result
With this filter:
– The **instant search box / dropdown from Advanced Woo Search PRO** will be hidden or disabled on:
– Any page with post type `lp`
– Any page that has `is_hide_instant_search` set to true in ACF
– The default Woo search functionality or your **client-side instant search plugin** will be free to take over.
—
### π§ Notes:
– This filter affects **just the AJAX dropdown**, not the search results page.
– If you also want to **prevent AWS from overriding the search results page**, combine this with the `aws_searchpage_enabled` filter (as shown earlier).
– Make sure ACF is active and the `is_hide_instant_search` field exists on the relevant post types or templates.
—
Let me know if you want to show **your custom instant search UI instead** when AWS is disabled β I can help you auto-load your plugin's UI as a fallback.
### β `aws_searchpage_enabled`
This controls whether **Advanced Woo Search** takes over the **search results page**, but not the **AJAX live search UI** (the dropdown).
—
## β Objective
You want to:
1. **Disable the Advanced Woo Search UI (dropdown AJAX search)** on certain pages:
– When post type is `lp`
– OR when the ACF field `is_hide_instant_search` is `1`
2. Use your **custom client-side instant search** instead.
—
## β Problem
Advanced Woo Search PRO **does not provide a filter** to disable just the **AJAX UI**, like `aws_is_search_enabled`. That means we need to **disable it another way**.
—
## β Solution: Deregister AWS JavaScript on Specific Pages
You can **deregister Advanced Woo Searchβs JavaScript** on those pages so the dropdown never appears.
Hereβs how:
—
### β Final Code (Add to `functions.php`):
add_action( 'wp_enqueue_scripts', 'conditionally_disable_aws_ui', 99 );
function conditionally_disable_aws_ui() {
if ( is_admin() ) return;
$post_type = get_post_type();
$page_id = get_queried_object_id();
// Use ACF safely
$is_hide_instant_search = function_exists('get_field') && $page_id ? get_field('is_hide_instant_search', $page_id) : 0;
if ( $post_type === 'lp' || $is_hide_instant_search == 1 ) {
// Dequeue AWS scripts and styles
wp_dequeue_script('aws-search'); // Main AWS script
wp_dequeue_script('aws-autocomplete'); // Autocomplete
wp_dequeue_style('aws-style'); // AWS styles
// Optional: Remove AWS HTML output via shortcode or widget
remove_all_actions('aws_before_search_form');
remove_all_actions('aws_after_search_form');
}
}
—
## β Explanation
– `wp_dequeue_script()` and `wp_dequeue_style()` **remove the AWS assets**, which disables the frontend dropdown.
– This disables AWS on **only those pages**, without touching the rest of the site.
– `remove_all_actions()` prevents any **HTML containers** AWS might output before/after search forms.
—
## β Optional: Disable AWS Form Completely (Widget / Shortcode)
If AWS is added via widget or `[aws_search_form]` shortcode, and you want to hide that too:
add_shortcode( 'aws_search_form', 'conditional_disable_aws_shortcode' );
function conditional_disable_aws_shortcode( $atts ) {
$post_type = get_post_type();
$page_id = get_queried_object_id();
$is_hide = function_exists('get_field') ? get_field('is_hide_instant_search', $page_id) : 0;
if ( $post_type === 'lp' || $is_hide == 1 ) {
return ''; // Return nothing, hide the form
}
// Render the actual shortcode
return do_shortcode('[aws_search_form_original]');
}
Then youβd need to:
– Rename the original shortcode in AWS to `[aws_search_form_original]` (if you override it).
—
## β Summary
| Goal | Solution |
|——————————-|——————————————-|
| Disable AWS live UI on pages | `wp_dequeue_script()` + ACF condition |
| Prevent AJAX assets loading | Remove AWS JS/CSS on target pages |
| Use your custom search instead| Your plugin UI loads normally |
—
Let me know if you want to **fallback to your client-side search plugin** automatically when AWS is disabled β I can help with that too.
aws_meta_keys_include filter Admin hook. Add to the array of meta fields additional fields.
aws_meta_keys_unfiltered filter Admin hook. Array of meta fields for the settings page before filtering.
aws_admin_page_options filter Admin hook. Filter options array for the plugin settings page.
aws_before_strip_shortcodes filter Index table hook. Filter product strings before stripping shortcodes.
aws_special_chars filter Special characters to remove from the product strings.
aws_diacritic_chars filter Filters array of diacritic chars.
aws_normalize_string filter Filters products normalized strings.
aws_synonyms_option_array filter Filters synonyms array before adding them to the index table.
aws_front_filters filter Array of search form filters before output.
aws_front_data_parameters filter Filter search form settings.
aws_searchbox_markup filter Filter search form HTML output.
aws_search_page_filters filter Active products filters of current search results page.
aws_products_search_page_filtered filter Product on search results page after filters apply.
aws_products_order_by filter Filter order by value for search results page.
aws_products_order filter Product on search results page after the ordering.
aws_index_posts_per_page filter Index table hook. Number of products to be indexed per iteration.
aws_index_cron_runner_time_limit filter Index table hook. Maximum execution time for the index script.
aws_index_max_cron_attemps filter Index table hook. Max number of the index script repeats before failing.
aws_index_product_ids filter Index table hook. Array of products IDs that will be indexed.
aws_index_apply_filters filter Index table hook. Apply or not standard content filters for indexed data.
aws_indexed_title filter Index table hook. Filters product title before it will be indexed.
aws_indexed_content filter Index table hook. Filters product content before it will be indexed.
aws_indexed_excerpt filter Index table hook. Filters product short description before it will be indexed.
aws_indexed_custom_fields filter Index table hook. Filters product custom fields before they will be indexed.
aws_indexed_data filter Index table hook. Filters product data before adding to the index table.
aws_create_index_table_sql filter Index table hook. Filters SQL query that will be using to create index table.
aws_extracted_string filter Index table hook. Filters extracted from the product data strings before index.
aws_extracted_terms filter Index table hook. Filters array of product terms before index.
aws_page_results filter Total number of search results for search results page.
aws_posts_per_page filter Number of search results per page for search results page.
aws_searchpage_enabled filter Display or not plugin results for current search results page.
aws_search_page_results filter Array of results for search results page.
aws_search_page_query filter Search query string for search results page.
aws_search_results_products_ids filter Array of product IDs to display as search results.
aws_search_results_products filter Filter products search results.
aws_search_results_tax_archives filter List of enabled for search taxonomies archive pages.
aws_search_results_all filter Filter all search results before displaying.
aws_search_terms filter Filters array of search terms before generating SQL query.
aws_tax_filter_include_childs filter Include or not child terms for taxonomies filter.
aws_exclude_products filter Exclude certain products from the search results.
aws_search_current_lang filter Products language to search for.
aws_search_query_array filter Filter search query parameters.
aws_search_query_string filter Filter search query SQL string.
aws_title_search_result filter Product title inside search results list.
aws_excerpt_search_result filter Product excerpt inside search results list.
aws_search_pre_filter_products filter Filter products array before the output.
aws_image_size filter Size of product images inside search results block.
aws_highlight_tag filter Tag to use for highlighting search words inside the content.
aws_tax_search_data filter Filters the array of taxonomies search data.
aws_search_terms_number filter Maximal number of taxonomies archive pages inside search results.
aws_terms_search_query filter Filter taxonomies archive pages SQL query string.
aws_search_tax_results filter Filter taxonomies archive pages results.
aws_search_terms_description filter Search or not inside the taxonomy terms description.
aws_search_tax_exclude filter Exclude certain taxonomies terms from the search results.
aws_terms_exclude_$taxonomy_name filter Exclude certain terms archive pages from the search results.
aws_users_search_data filter Filters the array of users search data.
aws_users_search_args filter Filter users search query arguments.
aws_users_search_query filter Filter users archive pages SQL query string.
aws_search_users_results filter Filter user archive pages results.
aws_js_seamless_selectors filter Selectors for search form js replacement.
aws_js_seamless_form_id filter Form that will be used for JS seamless integration.
aws_js_seamless_searchbox_markup filter Filter seamless integrations default form markup.
aws_search_start action Fires each time when performing the search.
aws_cache_clear action Fires each time when the plugin cache was cleared.
aws_form_changed action Fires after the search form instance was created/copied/deleted.
aws_filters_changed action Fires after the search form filter was created/copied/deleted.
aws_settings_saved action Fires after the plugin settings were saved.
aws_create_index_table action Fires when the plugin index table is created.
aws_index_complete
above are the avialable hook
β **No hook directly disables the instant search UI** (like `aws_is_search_enabled`) is present.
β
However, we **can still control** the frontend UI (dropdown/instant search) using the hooks that affect the **form output and JS integration**.
—
## β Goal Recap
You want to:
– Disable the **instant search UI** from AWS PRO
– When:
– Post type is `lp`
– OR ACF field `is_hide_instant_search` is `1`
—
## β Best Available Hook: `aws_searchbox_markup`
This filter lets you **change or remove the entire HTML output of the AWS search box** β effectively disabling the UI.
—
## β Final Working Code
Add this to your `functions.php` or a custom plugin:
add_filter( 'aws_searchbox_markup', 'conditionally_remove_aws_searchbox_markup' );
function conditionally_remove_aws_searchbox_markup( $markup ) {
if ( is_admin() ) return $markup;
$post_type = get_post_type();
$page_id = get_queried_object_id();
$hide_ui = function_exists('get_field') ? get_field('is_hide_instant_search', $page_id) : 0;
if ( $post_type === 'lp' || $hide_ui == 1 ) {
return ''; // β Remove the AWS searchbox HTML output
}
return $markup; // β
Keep default AWS UI
}
—
## π§ What This Does
– Uses `aws_searchbox_markup` to intercept the AWS form HTML output.
– Returns an empty string if the current page meets your condition.
– This **prevents the AWS UI from being shown or loaded**.
—
## β Optional: Remove JS If Needed
To prevent the AWS JS from initializing (for performance or complete UI removal), combine it with:
add_action( 'wp_enqueue_scripts', 'conditionally_dequeue_aws_scripts', 99 );
function conditionally_dequeue_aws_scripts() {
$post_type = get_post_type();
$page_id = get_queried_object_id();
$hide_ui = function_exists('get_field') ? get_field('is_hide_instant_search', $page_id) : 0;
if ( $post_type === 'lp' || $hide_ui == 1 ) {
wp_dequeue_script('aws-search');
wp_dequeue_style('aws-style');
}
}
—
## β Result
You now have a clean, non-hacky solution to:
– Fully disable **AWS Instant Search UI** on selected pages
– Still keep it working sitewide elsewhere
– Let your **custom instant search plugin** take over on those pages
—
Let me know if you'd like to toggle this based on post meta, WooCommerce product types, or template files β happy to help you expand this.
3
4
5
6
7
add_filter( 'aws_searchbox_markup', 'my_aws_searchbox_markup', 10, 2 );
function my_aws_searchbox_markup( $markup, $params ) {
$content = 'Start typing your search words here';
$form = '
Given this, here's how you can **adjust your working `aws_searchbox_markup` function** to conditionally **disable or hide** the **Advanced Woo Search UI** based on:
– If the post type is `lp`
– OR if the ACF field `is_hide_instant_search` is set to `1`
—
### β Final Adjusted Version:
add_filter( 'aws_searchbox_markup', 'my_aws_searchbox_markup', 10, 2 );
function my_aws_searchbox_markup( $markup, $params ) {
// Get post type and queried object
$post_type = get_post_type();
$page_id = get_queried_object_id();
// Get ACF field (if ACF is available)
$hide_ui = function_exists('get_field') ? get_field('is_hide_instant_search', $page_id) : 0;
// If post type is 'lp' or ACF field is set to hide the instant search
if ( $post_type === 'lp' || $hide_ui == 1 ) {
return ''; // Disable the AWS search form completely
}
// Otherwise, continue modifying the markup as usual
$content = 'Start typing your search words here';
$form = '<form class="aws-search-form"';
$markup = str_replace( $form, $content . $form, $markup );
return $markup;
}
—
### β What This Does
– **Returns nothing (`''`)** if you're on a page that should not show the AWS form.
– **Keeps your custom markup modification** (`Start typing your search words here`) on all other pages.
—
### β Bonus Tip: Use Your Custom Search Instead
If you're using your own instant search plugin (like the client-side one you showed), you can also **output your custom HTML instead**, like this:
return do_shortcode('[your_custom_search_shortcode]');
or:
return '<div id="your-custom-search-ui">...</div>';
—
Let me know if you also want to dynamically toggle this behavior based on device type (e.g., mobile only), user role, or WooCommerce conditions.