Home › Forums › Lite Version › exclude category › Reply To: exclude category
October 26, 2017 at 4:19 pm
#19074
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