0

I have a simple function to exclude a few categories from my Woocommerce shop page. This is the following code:

add_filter( 'woocommerce_product_categories_widget_args', 'woo_product_cat_widget_args' );
function woo_product_cat_widget_args( $cat_args ) {
$cat_args['exclude'] = '12, 13';
return $cat_args;
}

Which works like a charm. However, I have now added another category that I'd like to exclude with ID 22. So I tried adding that ID as well like: '12, 13, 22'; but when I save nothing happens, the category is still there.

So just as a test, I removed ID 13 and 22 but Category 13 doesn't appear either. I tried clearing my web browsers cache and also another browser but still the same result.

I am not using a cache plugin like W3 Total Cashe etc at this stage.

Any idea on how I can resolve this? :)

1 Answer 1

1

I have a similar code that is working fine for me. Try putting your ids into an array like so:

$cat_args['exclude'] = array('12, 13');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.