1

I have this function:

add_filter( 'prdctfltr_show_filter', 'my_hide_filter_on_category_function_jkbg4iu3b' );

function my_hide_filter_on_category_function_jkbg4iu3b() {
 if ( is_product_category( 'cheese' ) ) {
  return false;
 }
 return true;
}

Is any possibility to use ONE function and ONE filter but for MANY WooC Product Categories - not only for "cheese" but also for "sausages, wine, chocolate, etc" at ONE function and ONE filter?

Something like:

   or: if ( is_product_category( 'cheese' or "ham" ) ) {
   or: if ( is_product_category( 'cheese' || "ham" ) ) {
   or: if ( is_product_category( array => 'cheese, ham" ) ) {

?

3

Yes, you can use it like:

if ( is_product_category('cheese', 'fruit', 'meat') )
  • Thanks for your answer, but it NOT work. This is the problem - this function for some reason works only with 1 attribute. :( Here it's original info: help.xforwoocommerce.com/product-filter/… - maybe developers just don't do something what needs to use this function with many categories names?? :( – justdude Jan 18 at 14:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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