Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function one_cat_on_shop_page_query( $query ) {
- if ( ! $query->is_post_type_archive() ) return;
- if ( ! $query->is_main_query() ) return;
- if ( ! is_admin() && is_shop() ) {
- $query->set( 'tax_query', array(
- array(
- 'taxonomy' => 'product_cat',
- 'field' => 'slug',
- 'terms' => array( 'klinovi' ), // change 'klinovi' with your cat slug
- 'operator' => 'IN'
- )));
- }
- remove_action( 'pre_get_posts', 'one_cat_on_shop_page_query' );
- }
- add_action( 'pre_get_posts', 'one_cat_on_shop_page_query' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement