Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_action('pre_get_posts', function($q) {
- if(!$q->is_main_query()) return;
- if( is_shop() || is_product_category() || is_product_taxonomy() || is_product_tag() ) {
- $args = array(
- 'fields' => 'ID',
- 'meta_query' => array(
- 'relation' => 'OR',
- array(
- 'key' => '_disable_vendor',
- 'compare'=>'EXISTS',
- ),
- array(
- 'key' => '_wcfm_store_offline',
- 'compare'=>'EXISTS',
- ),
- ),
- );
- $vendors = get_users($args);
- $q->set('author__not_in', $vendors);
- $product_args = array(
- 'limit' => -1,
- 'status' => array('archived'),
- 'return' => 'ids',
- );
- $product_ids = wc_get_products($product_args);
- $q->set('post__not_in', $product_ids);
- }
- return $args;
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement