Hide a page or post from navigation in WordPress

December 3, 2008 by deauxmain  
Filed under WordPress Secrets


Have you ever wanted to create a page in WordPress, but didn’t want it to show up on the menu?  Well, a client recently wanted me to create a “thank you” page on her WP site. After trying to figure it out on my own, I did some searching on Google and found the perfect tip to handle this.

You’ll have to be confident in editing the header.php page on your WP site.

Go to your WP admin panel then to Design > Theme Editor > then click on header.php in the Theme Files on the right.

Find the code below, which should be approximately 3/4 the way down the page.

<?php wp_list_pages('sort_column=menu_order&depth=1&title_li=&exclude= 30,47,68,102,113'); ?>

Add the page ID's that you want to exclude here: exclude=15,47,68,102,113'); ?>

You can find the page or post ID’s by going to the WP admin panel, then go to Manage page or post.  Mouse over the page or post titles while looking at the status bar at the bottom of your screen. The ID number is the number at the very end of the link that shows. You can view the screenshot below:

WordPress Tip - Hiding Pages or Posts From Navigation

WordPress Tip - Hiding Pages or Posts From Navigation

There is much more that you can do with this, such as hiding posts in the sidebar navigation, but I’m not going to get into that here. You can see more on this where I initially found the tip that got me out of a bind on the very helpful site http://jarretcade.net. Jared has some great tips.

You can also contact me here if you would like some help on your WordPress site.

Please spread the word by sharing this post with your friends. Thanks!
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • E-mail this story to a friend!
  • LinkedIn
  • MySpace
  • Reddit
  • Technorati
  • TwitThis

No related posts.

Comments

9 Comments on "Hide a page or post from navigation in WordPress"

  1. web hosting on Fri, 20th Feb 2009 2:21 pm 

    Can you provide more information on this?

  2. deauxmain on Fri, 20th Feb 2009 3:17 pm 

    There is also a good plugin that will exclude pages from the menu or navigation. It doesn’t work with excluding posts though.

    http://wordpress.org/extend/plugins/exclude-pages/

  3. Judy Hutchins on Mon, 2nd Mar 2009 3:11 am 

    Good tips. This works great if you want to hide a special post from the public.

  4. affiliate on Tue, 17th Mar 2009 7:57 pm 

    Very nice information. Thanks for this.

  5. Matt Cassarino on Fri, 22nd May 2009 9:20 am 

    Thanks! This was super helpful and very easy to implement!!

  6. austinwebdesign on Mon, 12th Oct 2009 11:14 am 

    Thanks. This really is an awkward way of hiding pages from the navigation. In any other CMS there'd be a simple option in the backend. You'd think Wordpress would be able to do better.

  7. deauxmain on Mon, 12th Oct 2009 11:19 am 

    Yes, this is awkward. Since I made this post I found a plugin that does this much easier. It's the Exclude Pages plugin…just a little checkbox to tell it to add or exclude from navigation. http://www.youtube.com/trapezeexperience#p/a

  8. deauxmain on Mon, 12th Oct 2009 11:21 am 

    Yes, there is a better way to do this now. I found the Exclude Pages plugin, which allows you to check a box to either include or exclude from navigation.

    http://wordpress.org/extend/plugins/exclude-pages/

  9. phuonglive on Sat, 19th Dec 2009 4:57 am 

    Thanks for good tip. Another way is to use css in the name of the page, for example you create a new page, make the title like : < span style=”display:none;”>your title page</span> ^^

Tell us what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!