How to Exclude Categories from Navigation in WordPress
March 4, 2010 by Achinta "Archie" Mitra
Filed under Random Thoughts, WordPress & Websites
Most premium themes have two sets of main navigation, 1) Pages and 2) Categories. Two questions that come up often are:
1. How do I exclude categories from the navigation?
2. How do I change order from the default alpha order?
I’ve found several ways of accomplishing both tasks. Choose the method that you find easiest to implement.
Excluding categories:
- Simple method – don’t post anything to a category that you want to exclude. This may not be always feasible, for example, let’s say you have a category called Featured Content to create a slideshow on your home page. You may want to list Featured Content as a category in your navigation.
- Plugin method – download Wordpress Navigation List Plugin NAVT and use it to manipulate your categories navigation. This is a powerful plugin (it’s free) with all kinds of features. However, it is officially compatible up to Wordpress 2.8.2. Use it with caution if you’ve upgraded to WP 2.9 or higher. Also, it is incompatible with Safari
- Edit PHP – I find this the surest way to change my navigation but it does require you to get under the hood and edit code. Here’s a step-by-step how-to:
- Log into your WP admin panel
- Click on Appearance > Editor from the left hand column
- Click on header.php from the right hand column (the file may be named differently in your theme)
- Now look for this line of code:
<?php wp_list_categories(‘orderby=name&title_li); ?> - Change it to
<?php wp_list_categories(‘orderby=name&title_li=&exclude=X,XX,XX’); ?>
Where X, XX,…are your category IDs. - To find category IDs, go back to your admin panel and go to categories. From there hover over a category name and look for the ID at the bottom. NOTE: You can also enter category names but I find ID to be foolproof.
I found another plugin called Reveal IDs for WP Admin that makes it a lot easier to find page and category IDs.
- Update and preview to see changes
Sorting category order:
You can edit PHP code here too but I found a really wonderful free plugin that does the job very easily. It is called Category Order. You can drag and drop your categories to reorder you navigation. Even though the download page says it is compatible with up to WP 2.5.1, I am using it WP 2.9.2 and it works flawlessly.
NOTE: You can’t exclude categories only sort with this plugin. So you’ll need a combination of this plugin and one of the above methods if you need to exclude a category that has a post.
If you want more power than the default Categories widget for your sidebar, get hold of a plugin called AVH Extended Categories Widgets (also free). It will let you exclude, sort and do lots of other things to categories in your sidebar. You can see it in action on my Health and Wellness niche site.
That’s all there is to customizing your categories navigation in your Wordpress theme. If you interested in learning more, check out these great WordPress Video Tutorials. (Yes, that’s my affiliate link).
Find this post helpful? Add your own ideas by leaving a comment.













I’ve always been afraid to mess with code but this post showed me an example of what and where to look for something and what to change. I don’t think it’s that hard. Thanks for posting this.
Glad you found this post helpful. As long as you back up your WP database regularly, you can safely make edits and if things do get messed up, just restore it from your backup.