Hidden pages visible in ajax search results
-
Hi there!
I use woodmart theme for my shop which comes along with an ajax search in the header, where you can search for products, posts and pages (option “all post types” for this kind of search). Unfortunatelly, this ajax search shows pages hidden by searchexclude in the results. I got a snippet (add_filter function) from the woodmart support team to hide hidden products from this search:add_filter( 'woodmart_ajax_search_args', function ( $args, $post_type ) {
$args['tax_query'][] = array(
'taxonomy' => 'product_visibility',
'field' => 'name',
'terms' => ['exclude-from-catalog', 'exclude-from-search'],
'operator' => 'NOT IN',
);
return $args;
}, 10, 2 );Now I need an addidtional query to be able to exclude hidden pages. Something like this:
add_filter( 'woodmart_ajax_search_args', function ( $args, $post_type ) {
$args['tax_query'][] = array(
array(
'relation' => 'OR',
array(
'taxonomy' => 'product_visibility',
'field' => 'name',
'terms' => ['exclude-from-catalog', 'exclude-from-search'],
'operator' => 'NOT IN',
),
array (
// what comes here to exlude hidden pages?
),
);
return $args;
}, 10, 2 );May you please help me with this problem? Woodmart support ends here because this topic concerns a third party plugin…
Thank’s a lot and best regards,
Kerstin
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- You must be logged in to reply to this topic.