FacetWP – exclude certain terms from the WC shop archive

mgibbs189

{{gist file=”functions.php” lang=”php”}}
<?php

add_action( ‘pre_get_posts’, function( $query ) {
if ( $query->is_shop() ) {
$query->tax_query = array(
‘relation’ => ‘AND’,
array(
‘taxonomy’ => ‘category’,
‘operator’ => ‘NOT IN’,
‘value’ => ‘custom-tile’,
‘field’ => ‘slug’
),
array(
‘taxonomy’ => ‘post_tag’,
‘compare’ => ‘NOT IN’,
‘value’ => ‘sample’,
‘field’ => ‘slug’
)
);
}
} );
{{/gist}}