Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_action( 'woocommerce_product_query', 'ts_custom_pre_get_posts_query' );
- function ts_custom_pre_get_posts_query( $q ) {
- $tax_query = (array) $q->get( 'tax_query' );
- $tax_query[] = array(
- 'taxonomy' => 'product_cat',
- 'field' => 'slug',
- 'terms' =>array( 'free' ), // Don't display products in the free category on the shop page.
- 'operator' => 'NOT IN'
- );
- $q->set( 'tax_query', $tax_query );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement