Friday, March 20, 2009

Hiding Pages in Wordpress

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.


Thank you realiventblog.com for this useful post :)

No comments: