Excluding categories by slug from the Category Widget
-
I have this bit of code that works wonderfully well for removing categories from the sidebar category widget. However, I can only use IDs and I would much rather have it use the category slug. I’m not a developer, and I’ve wasted a good few hours hacking around trying to make it work with other code i have that uses slugs for things, but I just don’t know enough to get there. If anyone could help, that would be fabulous, and I believe this could be quite useful to others as well.
<?php function exclude_widget_categories($args){ $exclude = "1"; // The IDs of the excluding categories $args["exclude"] = $exclude; return $args; } add_filter("widget_categories_args","exclude_widget_categories"); ?>
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Excluding categories by slug from the Category Widget’ is closed to new replies.