How To Remove or Hide Categories from the Default Category Sidebar Widget in Wordpress

This is a lot easier than one might think but there is a lot of misleading (due to older versions of Wordpress being different) information out there - so I decided to post this once I pieced it all together.

 

1.  Find the category that you want to exclude - you need the category number specifically.

2.  While many people find editing core functions of Wordpress intimidating - it isn't that bad and sometimes is easier than a plug-in that you will then need to worry about updating, etc...

3. Go to your core Wordpress code on your host and navigate to the wp-includes directory.

 

4.  Open the file:  default-widgets.php

 

5.  Search for the phrase "wp_list_categories"

 

6.  The full phrase you should see there will look like "wp_list_categories(apply_filters('widget_categories_args', $cat_args));"

 

7.  Right before that phrase, type the following:

 

$cat_args['exclude'] = 'PUTTHENUMBERYOUWANTTOEXCLUDEHERE';

 

8.  Careful of all the syntax, don't forget the semi-colon there at the end (see above).

 

9.  You can add any other filters by doing the exact same thing just repeated - they are all listed here:  http://codex.wordpress.org/Template_Tags/wp_list_categories

If they didn't want us editing core files, then why not put some of these options in the default widget?

Need a fix to get categories out of your RSS Feed or Home/Category pages?  Try http://www.jangro.com/excluding-posts-from-your-blog-feed/

Posted on Wednesday, February 13, 2013 at 02:40:00 PM in Stuff
blog comments powered by Disqus