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
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.
No related posts.











web hosting on Fri, 20th Feb 2009 2:21 pm
Can you provide more information on this?
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/
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.
affiliate on Tue, 17th Mar 2009 7:57 pm
Very nice information. Thanks for this.
Matt Cassarino on Fri, 22nd May 2009 9:20 am
Thanks! This was super helpful and very easy to implement!!
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.
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/
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> ^^
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.
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!
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. .`
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?
Antonio on Wed, 2nd Jun 2010 3:32 pm
Sweet! Now I can make some tweaks to some themes I’m using.
snapwebsolutions on Tue, 8th Jun 2010 8:44 pm
Awesome. Kudos for posting and sharing this very friendly info.
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.
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