Apr
2007
4

How to hide Pages in wordpress

by Matt

You might run across a time in your life when you need to hide a page in wordpress.

You have 3 options to do this:

  1. 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

  2. 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

  3. 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:

Popularity: 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


  • 16 Responses to “How to hide Pages in wordpress”

    1. Ben Feltes

      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.


    2. matt (http://realivent.com)

      Thanks for the tip on the exclude…I didn’t know it was ordered.

      “hide” is very logical…maybe too logical


    3. Stacey M. (http://http//:stateofmindrealestate.com)

      While on the subject of pages, is the a way to change the order? I’ve done some research and have found nadda.


    4. Dana

      I want to exclude a page from the navigation bar but want to link to it but the above options did not work.


    5. BlogsAndBucks (http://blogsandbucks.com)

      I 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.


    6. Hiding Pages with Wordpress part 2 - Errors, Omissions, and Solutions » Realivent Real Estate Technology Blog (http://realiventblog.com/2007/06/15/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 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. […]


    7. Web (http://apartmani-istrapuntizela.com)

      Very good. It made my life easier without need to use any of the plugins. Many thanks for the tip.


    8. Bob LaPlante (http://laplanteenterprises.net)

      Interesting 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


    9. Aly (http://gamil.com)

      I think I figured it out for option one:
      1. Publish the page.
      2. Then go back to edit tha page and THEN mark it as “draft”


    10. matt (http://smartlegacy.com)

      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


    11. Another Step In hiding or excluding WordPress Pages at Top 10 Tech Web Tips (http://www.top10tech.com/web/2008/01/29/blogging-tips/another-step-in-hiding-or-excluding-wordpress-pages/)

      […] How to hide Pages in wordpress […]


    12. Kimberly (http://www.silverwebdesigns.net)

      The 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,
      Kimberly


    13. Market Secrets Blogger (http://marketsecrets.biz/supertips-for-2008-and-2009/)

      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 ;)


    14. John

      @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.


    15. strupal

      @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.


    16. TP (http://tarwynpark.com)

      why 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)


    Leave a Reply

    Close
    E-mail It
    Rodney's Adsense-Deluxe Add ons plugged in.