Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Search all content UNLESS slider chosen › Reply To: Search all content UNLESS slider chosen
November 8, 2021 at 4:01 pm
#35469
Keymaster
Hi,
Well, it might be doable. There is a way to detect on the server side if the filters are in the initial state. However this only works if all the filters are at initial state.
Try adding this code to the functions.php file in your theme/child theme directory – make sure to have a full server back-up first for safety. For more details you can check the safe coding guidelines.
add_filter( 'asp_query_args', 'asp_reset_post_meta_filter_initial', 10, 3 );
function asp_reset_post_meta_filter_initial($args, $search_id, $options) {
if ( $options['filters_initial'] ) {
$args['post_meta_filter'] = array();
}
return $args;
}
This code will basically reset all meta field filters whenever the initial state is detected. Once it changes, it not longer activates.