W3 Mind Logo
Home » Hiding Specific Blog Categories from WordPress Widget

Hiding Specific Blog Categories from WordPress Widget

Hiding Specific Blog Categories from WordPress Widget

Here’s the way to hide any specific categories from the WordPress category widget. You just need to add the following code in your functions.php

As you can see there are two types of 1) for the default Categories Widget and 2) for the Categories Widget to “Display as dropdown”

				
					/* this removes the categories from the list */
function remove_widget_categories($args){
	$exclude = "14";
	$args["exclude"] = $exclude;
	return $args;
}
add_filter("widget_categories_args","remove_widget_categories");

/* this removes the categories from the dropdown */
function remove_widget_dropdown_categories($args) {
	$exclude = "14"; 
	$args["exclude"] = $exclude;
	return $args;
}
add_filter("widget_categories_dropdown_args","remove_widget_dropdown_categories");
				
			

If the above code doesn’t work, there may be a plugin or theme conflict that’s preventing the code from working.

About Author
Picture of W3Mind

W3Mind

W3Mind focuses on Blogging, Make Money Online, SEO, Business Blogging, Social Media, WordPress, Internet Tools, Web Design and Development.
Give it a Share
Facebook
Twitter
LinkedIn
You May Also Like
How to
START A
BLOG
(step by step)
Load WordPress Sites in as fast as 37ms!