- This topic has 13 replies, 5 voices, and was last updated 3 years, 2 months ago by
Leo.
-
AuthorPosts
-
January 10, 2023 at 3:16 am #2489870
Royal Rangers
Hi, how I can hide a specific category from dropdown category widget. I try this code:
function exclude_widget_categories($args){ $exclude = "23"; $args["exclude"] = $exclude; return $args; } add_filter("widget_categories_args","exclude_widget_categories");Doesn´t work. Is there any other way to make a dropdown custom menu?
Thanks for help.
January 10, 2023 at 5:56 am #2490048David
StaffCustomer SupportHi there,
try the
widget_categories_dropdown_argsfilter instead:function exclude_widget_categories($args){ $exclude = "23"; $args["exclude"] = $exclude; return $args; } add_filter("widget_categories_dropdown_args","exclude_widget_categories");January 12, 2023 at 1:11 pm #2493421Royal Rangers
Still don´t working.
January 12, 2023 at 1:13 pm #2493422Leo
StaffCustomer SupportThe code looks good to me – make sure the category ID is set correctly.
Any caching plugins that might need to be cleared?
If not can you check with WordPress’ support team to see if we’ve missed anything?
Or I Googled “widget_categories_dropdown_args” and saw quite a few examples that might worth trying as well.
January 12, 2023 at 1:20 pm #2493429Royal Rangers
Any cache plugin.
January 12, 2023 at 1:22 pm #2493432Leo
StaffCustomer SupportAny cache plugin.
I don’t see any from looking at the source but that would be up to you to confirm. Sometimes there are server and hosting caching as well.
I found another post that suggested the same code so I’d assume that the code is correct:
https://basicwp.com/exclude-categories-from-category-widgets-in-wordpress/You would need to check with WP’s support team if it doesn’t work as this isn’t something the theme can control.
Thanks for your understanding.
January 12, 2023 at 1:34 pm #2493444Royal Rangers
I trying both code on another page, still don´t working.
I try another webpage and still doesn´t work.January 12, 2023 at 6:10 pm #2493613Ying
StaffCustomer SupportHow did you add the code?
Make sure it’s added using one of the methods introduced here:
Adding PHP: https://docs.generatepress.com/article/adding-php/January 12, 2023 at 9:21 pm #2493720Royal Rangers
I adding code in functions.php via child-theme.
January 12, 2023 at 9:29 pm #2493726Fernando Customer Support
Hi Jan,
Can you provide admin login credentials so we can take a closer look?
Please use the Private Information field for this: https://docs.generatepress.com/article/using-the-premium-support-forum/#private-information
January 16, 2023 at 2:51 pm #2498106Royal Rangers
Hi, yes I can.
January 16, 2023 at 4:29 pm #2498177Leo
StaffCustomer SupportThe code is added in the correct place from what I can tell.
Would setting the snippet to Run Everywhere instead of Site Wide Header help?
If not then please check with WordPress support team to see if they have an idea why it’s not working.
Thanks for your understanding.
January 16, 2023 at 9:34 pm #2498370Royal Rangers
Doesn´t work too. I will try a WordPress support. Thanks for help.
January 17, 2023 at 10:56 am #2499251Leo
StaffCustomer SupportNo problem 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.