How to hide a category from wordpress main navigation

This is a small tip that could be hugely useful for my friends who are not very sure on how to edit the wordpress theme or modify the navigation at times when the them does not have inbuilt option and there are huge number of  categories. To avoid your navigation bar becoming very clogged its better to exclude some un important categories from the main navigation and may be include them on the side bar. Here is how you could do it.

Log on to your admin dashboard on wordpress. Proceed to theme editor -> open header.php in edit mode.


<?php wp_list_categories(‘title_li=&orderby=id’); ?>

Replace with:

<?php wp_list_categories(‘exclude=4,1,35,30,34,8,51,6,7,64,13,65&title_li=’); ?>

where 4,1,35 etc are the category ids. Hope this helps