In functions.php
add_action( ‘pre_get_posts’, ‘query_posts_order_price’);
function query_posts_order_price($query) {
if ( $query->is_search ) {
$query->set( ‘tax_query’, array(
array(
‘taxonomy’ => ‘product_cat’, // taxonomy
‘field’ => ‘slug’,
‘terms’ => array( ‘cat1’, ‘cat2’ ), // categories to be removed
‘operator’ => ‘NOT IN’ // Operation
)));
}
}