Quick Tip : Exclude Pages From Menu Navigation Bar Manually

Sometimes we wanted to create pages in WordPress but don’t want them listed in the header navigation areas. For example you want to make the page ‘Guides for using RSS feeds’, and you think this page should not be displayed on the navigation menu. Or you feel that your pages in menu navigation bar is too much, so that your header looks neat?

exclude pages

But you still want the pages to be accessible, perhaps listed in the sidebar, so you don’t want to make them private. You can do this by excluding pages and in this article will show you how to do it.

How To?

Step 1. Change header.php file

  • Open file header.php from your theme folder. Look for
    <?php wp_list_pages('title_li=&depth=1'); ?>
  • and change with
    <?php wp_list_pages('title_li=&depth=1&exclude='); ?>
  • Save it.

Step 2. Find the page ID
Then you must enter the ID page that you want to exclude. Below the steps how to find the ID pages :

  1. Go to Pages > Edit in your WordPress admin panel.
  2. Hover one of your page.
  3. As you can see in this picture below our ID is 146.find page ID

Step 3. Enter the page ID

  • Back to your file header.php. look for
    <?php wp_list_pages('title_li=&depth=1&exclude='); ?>
  • Enter your page ID in this code, like this
    <?php wp_list_pages('title_li=&depth=1&exclude=146'); ?>
  • For exclude more than one page (Use comma between the page IDs)
    <?php wp_list_pages('title_li=&depth=1&exclude=2,10,12,146'); ?>
  • Save it!

That’s All, Folks!

We’re done! I hope it will useful, please feel free to leave a comment below. Thanks :)

15 Comments to “Quick Tip : Exclude Pages From Menu Navigation Bar Manually”

Add Comments (+)

  1. Connie says:

    as these IDs are necessary but neglected in the Admin Dashboard, there is a really useful plugin:

    http://wordpress.org/extend/plugins/reveal-ids-for-wp-admin-25/

    I recommend to use that as you will see all IDs at the correct place and you must not hover along and try to catch some filthy URL-parameters ;=)

    Cheers, Connie

  2. Eric says:

    is a great,thanks for share.

  3. Great site. A lot of useful information here. I’m sending it to some friends!

  4. cna training says:

    Terrific work! This is the type of information that should be shared around the web. Shame on the search engines for not positioning this post higher!

  5. cna training says:

    Great information! I’ve been looking for something like this for a while now. Thanks!

  6. Angela says:

    Thank you so much for this! I have been struggling to get my nav bar fixed and everywhere else i went was not helpful in the least. I am so happy I have been able to scale it back and include extra pages in the sidebar now!

  7. Gray says:

    Hey… this is awesome! I’m already using the very same example on morris-roots.com… is there any chance that an inexperienced person (ie my client) can exclude pages without going into the code specifically?

    If they were going to add pages in the future, it may cause the entire navigation to misalign and I’d rather make it as straightforward so there is no room for mishaps!

    Would love to hear anyones response on this matter… thanks.

  8. this is very good source..thanks

  9. well, there are a lot information in the web “how to hide a page…”, but what happen when you want to hide a nav page from a specific post/page. Ex.:

    In home page you can find: Home – Page1 – Page 2 – Contact – About

    You create a new page
    In this page you want to hide Page1 and Page 2. Then the menu are:

    Home – Contact – About.
    any idea to do this?
    Valentin

  10. Thanks Reza, not thought of it. I was looking for a plugin, but this is a good option.
    Valentin

  11. I need to hide categories in Nav bar, Is it the same process cos I’ve been searching for this the whole day now. Please respond

Trackbacks/Pingbacks

  1. Tweets that mention Quick Tip : Exclude Pages From Menu Navigation Bar Manually | DynamicWP -- Topsy.com
  2. Quick Tip : Replace The Horizontal Page Menu With The Categories in WordPress Navigation Bar | DynamicWP

Leave a Reply

 

Amazingly Beautiful WordPress Themes