Hide a page or post from navigation in WordPress

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.

Be Sociable, Share!

Leave a Reply