Answer the question
In order to leave comments, you need to log in
Remove product filter in main category?
Comrades, I ask for help. I want to remove the product filter widget from the main category, and leave it only in subcategories. I use the default filter from Woocommerce "Filter by attributes". Its functionality is quite satisfactory. I use the code below to solve the problem. Taken from a toaster and published by WP_Panda. But as you might guess, it doesn't work. Help parse the code. Below I will write my analysis, please add and correct if there are errors.
add_action('init','wpp_remove_filter_in_specific_cat');
function wpp_remove_filter_in_specific_cat(){
if(is_product_category( 'ссылка на категорию' ) ) {
remove_action('woocommerce_before_shop_loop','функция из плагина фильтра которая вешает фильтр на экшен смотреть ее в плагине', 'приоритет с которым повешена функция на экшен смотреть ее там же');
}
}
Answer the question
In order to leave comments, you need to log in
You need to pass 4 parameters to it, but here 2. Error?If you look at the description, for example here , then there are only 2 required parameters
How to link correctly? 'santehnika'?Not a link, but a slug! see description, for example here .
The question is whether Panda correctly specified 1 parameter?Correctly! - in relation to the problem where you got it from (attentively open and re-read the entire correspondence). In your case, to look at which hook is displayed. Find your widget in the code and take a look. The simplest thing is to look at what classes the widget is displayed with and use the usual search in the plugins folder to find in which file there is a match.
And where to get 2 and 3.Well, here you already have the answer ("'function from the filter plugin that hangs the filter on the action, see it in the plugin', 'priority with which the function is attached to the action, see it in the same place'") Look in the same place, in the widget
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question