How do you exclude categories from navigation in wordpress?

I've tried putting this code in header.php: <?php wp_list_categories(‘title_li=&include=3,5,7,12′);?>

But it screwed everything up and there's no code in MY header.php to replace what I wrote above with? Is there a plugin for this that actually works? I don't seem to have the code in my header.php to replace with the normal code that seems to work for every body else.

3 Answers

  • 10 years ago
    Favorite Answer

    Wherever you have the current wp_list_categories() is where you modify it to look like this:

    wp_list_categories('exclude=4,7&title_li='); ?>

    You may just want to add the exclude section at the end like this:


    Here's how you find the id's of the categories you want to exclude. On the left-side menus click Posts > Categories. Then on the right-side list of categories run the mouse over the category name you want to exclude and in the bottom-left status bar of your browser you'll see the category id listed - like cat_ID=8.

  • 10 years ago

    Rather than a plugin, I'll suggest a WordPress theme. Many themes actually include all sorts of customization from the WP backend without hacking any code. Easier for non-PHP experts and less prone to error.

    I use Thesis for all my blogs. Changing navigation is as simple as clicking a checkbox and dragging text. Some info and tutorials are linked below if you think you might go that way.

  • 10 years ago

    Hey there

    I usually use this code : <? php wp_list_categories('exclude=1&title_li=');?>

    To exclude "uncategorized" category. Put that code in your nav code, don't forget to back up your files.

Still have questions? Get your answers by asking now.