Apr
2007
4
How to hide Pages in wordpress
by MattYou might run across a time in your life when you need to hide a page in wordpress.
You have 3 options to do this:
- Write the page as Draft. This will hide the page from the list of pages in the menu but you can still access the page by search, and the page will be accessible if you type the direct URL to the page.
I use this method a lot to provide pages when I do not want them in the menu. I like horizontal menus for my blogs, and if you add too many pages, your menus might start looking bad.
Example of hiding with a draft: Real Estate Blog Lab - Make the page private. This will remove the page from the menu, and you will not be able to access it by search, or by entering the URL. Please remember to log out once you make a page private. Many people make the page private and then try to access it immediately and find they can still see it. This is because you are logged in as "admin" still. So make the page private, logout and try to access the page.
This would be the preferred method to hide a page - The last way is to hardcode your menu function. Wordpress created the menu with this function: wp_list_pages();
You can either remove that function and add your own links, or add the "exclude" argument to wp_list_pages() like so:
wp_list_pages(exclude=17,38);The numbers are the page id's…you can get the page id's from the manage pages section of you wordpress blog admin section.
Since this method will probably never be used, I will not go to far into it.
I use hidden pages all the time, especially when I have a sidebar widget that displays a small snippet of information, but can open a full page when more details are needed.
Tags:Blogging Software wordpressPopularity: 23% [?]
Other posts you might be interested in
Hiding Pages with Wordpress part 2 - Errors, Omissions, and Solutions In a previous post, how to hide pages in wordpress, I talked about hiding pages in wordpress. I gave three Answers to a few common questions About wordpress The Wordpress questions are starting to roll in. The first couple questions come from Stacey Macioszek stateofmindrealestate.com Q. Listing Beautifier Wordpress Theme - Designed for Property Pages I spent all weekend fixing bugs, writing new plugins and creating my first Wordpress theme. Normally I just use one Spam Free and Lovin It! As I cruise around the internet I have noticed a lot of people using some funky email addresses. For example, Introducing the Zillow Wordpress Widget I think we nailed down all the bugs and ready to release this widget.Download it here (zip file)Extract and upload

It seems like they would make a “hide” option in the panel without having to these things, but maybe there’s more to it. The exclude method is what I use. I guess it’s notable that you have to list the excluded pages in ascending order.
April 4th, 2007 at 11:36 amThanks for the tip on the exclude…I didn’t know it was ordered.
“hide” is very logical…maybe too logical
April 4th, 2007 at 12:05 pmWhile on the subject of pages, is the a way to change the order? I’ve done some research and have found nadda.
April 5th, 2007 at 5:27 pmI want to exclude a page from the navigation bar but want to link to it but the above options did not work.
May 7th, 2007 at 6:02 pmI don’t know how #1 option is going to work. If you save a page as draft, no one will be able to see it except you as an admin.
Your #3 option does not work on WP 2.2 either. But after spending an hour i figure out that there is a easier way to hide a page from wordpress side bar or menu bar.
Open ..root/includes/post-template.php
Go to around line 287, it has a built-in option to exclude page from sidebar. Just add your post ID where it says
exclude’ => ‘YOUR POST ID HERE’,
This way you can hide the page from sidebar or menu but anyone can still access to the page.
June 15th, 2007 at 11:06 am[…] In a previous post, how to hide pages in wordpress, I talked about hiding pages in wordpress. I gave three solutions, one was wrong and the others were a little confusing. I could have sworn that the draft and private methods worked…maybe they were bugs in older versions? I want to thank a reader from blogsandbucks.com for pointing out that the draft method for hiding pages does not work. […]
June 15th, 2007 at 4:45 pmVery good. It made my life easier without need to use any of the plugins. Many thanks for the tip.
September 5th, 2007 at 6:41 amInteresting post.
Maybe the hideing of pages is theme dependant?
On one of my customers blog, I created a Page called hidden page holder and saved it as a draft. I then created pages that I wanted hidden, and made the hidden page holder the parent page.
I then logged out of admin, and visited the home page of the blog, and do not see the hidden page holder page (the draft) nor do I see the “published” child pages that are children to it.
However, I can access the hidden child page using a direct link.
Home page: http://gatewaydiscovery.com
Sample Published child, assigned to draft holder page: http://gatewaydiscovery.com/?page_id=17
As you will see, the only page displaying is Advertising, yet you can access the published child, that is assigned to a draft page.
Using WP version 2.2.2
Bob LaPlante
September 30th, 2007 at 4:15 amI think I figured it out for option one:
November 25th, 2007 at 5:45 pm1. Publish the page.
2. Then go back to edit tha page and THEN mark it as “draft”
Aly,
I think you can still see the draft page because you are logged in as administrator? Log out and see if you can see the page
Matt
November 26th, 2007 at 7:38 am[…] How to hide Pages in wordpress […]
January 29th, 2008 at 3:07 pmThe exclude pages worked beautifully! Thank you!
As a side note, on the newest version of Wordpress, I find that the line is around 305 in wp-includes/post-template.php.
Specifically:
‘child_of’ => 0, ‘exclude’ => ‘7′, // TO EXCLUDE PAGES FROM THE MENU OR NAV OR PAGE LISTING: come here and in numerical order, type a comma delimited list by page ID
Thanks for the tip, blogsandbucks. It worked like a charm.
Best regards,
June 4th, 2008 at 6:03 amKimberly
This problem has over-perplexed me for the simple fact #3 just wouldn’t work right no matter how many variations I did…but #1 -I knew nothing about and it’s so simple!
Now my TrafficXchange page is secure w/o throwing off my main navigation…thanx
February 13th, 2009 at 5:04 pm@Kimberly
Your solution worked for one page but how do I enter in multiple pages?
I tried separating them with a comma like this:
‘child_of’ => 0, ‘exclude’ => ‘197′,’205′,’201′,’199′,’186′,’203′,’191′,’193′,’195′,
and only the first page gets hidden and the rest still show. If you know of a solution to this problem, please let me know.
Thank you.
April 11th, 2009 at 5:16 pm@John:
Try listing the pages as a single string:
‘child_of’ => 0, ‘exclude’ => ‘197,205,201,199,186,203 191,193,195′,
Also, it may be necessary to list the pages in ascending numerical order.
April 15th, 2009 at 5:22 amwhy doesnt WP change the numbering system so that by simply giving the page a zero listing for order ie ‘0′ means page is hidden from the menu(s)
June 3rd, 2009 at 1:20 am