Hide a page or post from navigation in WordPress

December 3, 2008 by  
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

24 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: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/

  8. 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> ^^

  9. Joanna Benz on Thu, 15th Apr 2010 7:14 pm 

    There’s a plugin called My Page Order that makes it very simple to exclude pages from a menu.

    In fact, my website uses the My Page Order widget repeatedly to provide multiple menus with specific pages on a certain topic.

    I also like the My Category Order plugin, for sites that will have posts and categories. Both are highly recommended.

    For new users who aren’t sure whether to set up their blog using posts or pages, this article might help shed some light on things:

    http://unlimited-bandwidth-hosting.com/hosting-articles/setting-up-a-site/posts-versus-pages

    I do appreciate your posting the code fix. But some of us are a little paranoid about fiddling with code if we can possibly avoid it.

  10. deauxmain on Thu, 15th Apr 2010 8:47 pm 

    Thanks Joanna, that looks like a good plugin and solution. I’m no longer using the hard coding to accomplish this either. I’m using the Exclude Pages from Navigation plugin, which just adds a checkbox to show whether to add to navigation or not. I’ll have to take a closer look at My Page Order. Thanks for the tip, and for stopping by!

  11. Arlen Tock on Thu, 29th Apr 2010 9:29 am 

    Adwords is really good in driving traffic to your website. however, they are very strict right now and they would not easily approve websites that they thought have low quality content. .`

  12. MarkTheGlobe on Sun, 23rd May 2010 10:15 am 

    Interesting. I wonder if this can be done based on dynamic values like keywords as well?

  13. Antonio on Wed, 2nd Jun 2010 3:32 pm 

    Sweet! Now I can make some tweaks to some themes I’m using.

  14. snapwebsolutions on Tue, 8th Jun 2010 8:44 pm 

    Awesome. Kudos for posting and sharing this very friendly info.

  15. Edward on Sat, 12th Jun 2010 3:43 am 

    Thnaks for this post. It’s veru useful for me. I already tried it on my new WP site. Looks great.

  16. John @ Article Directory on Fri, 25th Jun 2010 2:08 pm 

    Thanks for the post. I’ve been slowly but surely learning new things about wordpress and this article has just added a little more to my knowledge.

    -John

  17. website hosting wales on Wed, 29th Sep 2010 12:32 pm 

    Thank you very much for this article. It will certainly come in most helpful in the very near future. Please keep the articles like this coming. They help me rather a lot!

  18. Beracha on Mon, 25th Oct 2010 7:16 am 

    Thanks, here is an updated link for the wordpress plugin. <a href="http://wordpress.org/extend/plugins/wp-hide-post/"

  19. deauxmain on Wed, 3rd Nov 2010 1:46 pm 

    Daniel…yes, a lot of the newer themes have come out since the original post that have this feature. I use the Thesis theme a lot, and it has the ability to exclude pages from the navigation. Thanks for stopping by…I love Lafayette!

  20. Mica Galleb on Mon, 22nd Nov 2010 7:24 pm 

    Wow, neat article. I’m happy that I was able to drop by on your site. A client of mine wanted a web design with some hidden pages. Your article and comments here really added to my knowledge esp in website design using word press. Thanks.

  21. vaseem on Wed, 23rd Feb 2011 5:06 am 

    i want to know how did you created this rotating tag cloud in wordpress for showing rotating tag of wordpress. the same u created in ur sidebar.
    u can send me reply or link on my mail id
    i want to show the same at my technology and hacking tips blog here
    http://www.vaseemansari.com/blog/

  22. deauxmain on Wed, 23rd Feb 2011 5:58 am 

    Hi Vaseem,

    The revolving tag cloud on in my sidebar is the WP Cumlus plugin. Find it here: http://wordpress.org/extend/plugins/wp-cumulus/ Thanks for stopping by! Bruce

  23. Paul Luxford on Tue, 24th May 2011 2:16 am 

    This was really helpful. I was trying to figure how to remove my home page navigation link and this did the trick. I appreciate the information and recommend it to anyone.

  24. deauxmain on Tue, 24th May 2011 5:00 am 

    Thanks Paul. This is a pretty old post, so all of the themes I use now already have this feature…especially with the new WP custom menu. But it does work well on the older themes.

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