I would improve the search bar in order to exploit manufacture attribute linked to product.
I try to use this to filter product by a custom meta (no product attribute)
function custom_search_query( $query ) {
if ( !is_admin() && $query->is_search ) {
$query->set('meta_query', array(
array(
'key' => 'manufacture',
'value' => $query->query_vars['s'],
'compare' => 'LIKE'
)
));
};
}
add_filter( 'pre_get_posts', 'custom_search_query');
But this puts this condition in AND
with standard query, I need to put it in OR
.
Any suggestions?