How to exclude Categories from Navigation in WordPress ?

Sometimes We want to exclude Specific Categories from navigation. Depending on the condition, some have too many categories to show in one navigation bar so they show the very important one in navigation rest in Sidebar widgets mostly. In other cases, some just don’t want to show the “Un-categorized” (default) category in their navigation bar.

This simple edit in the code will help you do so.

The Default Code:

<?php wp_list_categories(’title_li=&exclude=’ . $ex_aside) ?>

  • Now if you want to un-show some categories or want to show only those you want. Just do these simple steps.
  • Find the above code in Header.php of your theme file.

Replace it with this code:

<?php wp_list_categories(’title_li=&include=3,5,7,12?);?>

  • In the above code, 3, 5, 7 and 12 are the IDs of your categories. Only add IDs of those you want to show in navigation. Rest will be excluded.