woocommerce offtopic - WordPress function for 1 to for many

I have this function:add_filter( 'prdctfltr_show_filter', 'my_hide_filter_on_category_function_jkbg4iu3b&

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" ) ) {

?

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" ) ) {

?

Share Improve this question edited Jan 17, 2020 at 15:51 TomC 1,3168 silver badges18 bronze badges asked Jan 17, 2020 at 12:38 justdudejustdude 215 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 3

Yes, you can use it like:

if ( is_product_category('cheese', 'fruit', 'meat') )

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744825991a4595799.html

相关推荐

  • woocommerce offtopic - WordPress function for 1 to for many

    I have this function:add_filter( 'prdctfltr_show_filter', 'my_hide_filter_on_category_function_jkbg4iu3b&

    2天前
    60

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信