Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function exclude_specific_tag_from_shop_loop( $q ) {
- if (is_shop()){
- $tax_query = (array) $q->get( 'tax_query' );
- $tax_query[] = array(
- 'taxonomy' => 'product_tag',
- 'field' => 'slug',
- 'terms' => array( 'cross' ), // your tag slug here
- 'operator' => 'NOT IN'
- );
- $q->set( 'tax_query', $tax_query );
- }
- }
- add_action( 'woocommerce_product_query', 'exclude_specific_tag_from_shop_loop' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement