Reply To: exclude category

Home Forums Lite Version exclude category Reply To: exclude category

#19074
Masonry Guy
Keymaster

Hi Lee,

For custom post type and taxonomy (product category), you need to write complex query using the filter. Please keep this in your functions.php file and this should fix the issue.

add_filter('wmlp_query', 'my_custom_query_wmlp',10,2);
function my_custom_query_wmlp($args, $shortcodeID){
  if ($shortcodeID == #){ // HERE # is shortcode ID
    $args['tax_query'] = array(array(
               'taxonomy' => 'product_cat',
               'field'   => 'slug',
               'terms'   => 'YOUR_CATEGORY_SLUG_HERE',
               'operator' => 'NOT IN'
           ));
    return $args;
  }
}

Thanks