Creating Password Protected Pages and Areas in WordPress

Creating Private, Password Protected Sections on Your WordPress Site

I had a client recently who needed to create private, password-protected sections on her WordPress site. She wanted each of her clients to have a private page with information related to what they were working on together. Easy! Password-protection is an in-built feature of WordPress, in case you didn’t know.

When creating a page, you simply click “Edit” next to Visibility in the Publish box on the right. Choose “Password protected” and set the password as you choose.

Create a password protected page in WordPress

But what if you want to create a series of pages for the same client to access? Even if you set the same password for each one, it would be cumbersome to have your client have to re-enter it to see each page in their section.

WordPress actually handles this by default. If you have multiple pages with the same password, the user will only have to enter the password once, and not for subsequent pages with the same password.

So the next question is, how to provide an easy way for your client to navigate the private area you have created for them?

Weekly WordPress Tips To Your Inbox

  • This field is for validation purposes and should be left unchanged.

A simple solution I found is courtesy of the List Pages Shortcode plugin. As the name suggests, by placing a shortcode in any page or post, it will display a list of your pages.

If you were to use the basic shortcode:
[list-pages]

you would display a list of ALL your pages. Of course you only want to display the pages for that particular client or section.

So instead use the shortcode:
[list-pages child_of=”11″]

where “11” is the ID of the parent page.

An easy way to find the ID is to look at the URL when on the edit screen for the page:
find the page ID

As an example I created a main/Parent page for Client A, with 2 subpages. The parent page is the “login” page with very little besides the list of pages on it.

Client login page

 



This page will function as a “login” page for the client:
smart passworded pages

The child pages also have the basic navigation for convenience:

list pages shortcode

 

 

And the result is a simple way for my client to navigate their private section on my site:

child_page_navigation

 

In addition to private client pages, what else might you use this for on your site?

This method isn’t a solution for creating membership sites where you want to sell access to content, for example. For that type of more complex setup, you’ll need a fully-featured membership plugin, like MemberPress or Paid Memberships Pro.

Memberpress - WordPress membership plugin
Read the guide on Getting Started with MemberPress
Would you like to show custom content on your password protected page? See this guide
Read this if you want to password protect your entire WordPress site

*header image courtesy: http://www.flickr.com/photos/holster/195031415/

This Post Has 26 Comments

  1. Suzie Wayne

    Hi Lucy,

    Thanks for the useful guide. Is there a solution to password protect part of a post?

    1. Lucy

      Hi Suzie – yes there are plugins available for that such as: https://wordpress.org/plugins/content-protector/

  2. Matt

    Hi, very useful, I hated making the list of subpages manually! very nice solution.

  3. Leon

    I password-protected pages, but when users enter the password for that page (and, yes, it is the correct password), WordPress simply asks for the password again … and again … and again. It does not allow access.

    I have changed and disabled themes and plugins, and the problem persists. Any ideas why?

    1. Lucy

      Really hard to say without seeing the site. Maybe a caching issue?

    2. Jan Bear

      I had this problem (I know it’s year’s later, but I hope to save someone else the time to figure it out.)

      The password doesn’t work if the page isn’t loading on SSL. The URL needs to begin with https:// — a whole ‘nother thing, but that’s why it didn’t work for the site I was looking at.

  4. John

    I password protected a page some time ago but have mislaid the password. How do I solve this problem?

    1. Lucy

      Just set a new password for that page.

  5. Randy M

    Is there a way to have more than one password that could be entered? With each password taking you to a different page? for setting up tier pricing?

    1. Lucy

      Hi Randy – for that type of setup, you should really be looking at a more fully featured membership plugin like MemberPress or Paid Memberships Pro.

  6. Kim Woodbridge

    Hey Lucy – Thanks for this post. I need to password protect part of a site with a single password for all users. This article and the plugin suggestions got me on the right track. I ultimately decided to make it a separate site because it’s easier to protect the single site with one password but you gave me some great ideas and helped me get my thoughts in order.

  7. Kevin

    How do you customize the Password Protected screen????

  8. Paul Farrington

    Thanks for the advice this has worked a treat on our new project

  9. Taimoor

    How can we make certain part of the post password protected?

    1. LucyBeer

      Sounds like you'll need something like the "Members" plugin by Justin Tadlock

  10. LucyBeer

    For all those that let me know that the plugin Password Protect Children Pages was out of date – thanks! I have updated the post and now recommend "Smart Passworded Pages"

  11. brennen

    any way now to kick those over to the sidebar? i want the sub pages hidden until the password in entered. but i dont want them right there on top. I cant get anything else to work.

  12. Andreas

    Hi Lucy,
    what if you have htaccess protection installed in the admin folder? I discovered that every password protected page or post asks for the username and password of the htaccess protected folder first followed by the specific password for a page or a post. Obviously wordpress make use of the login functionality even in case of a simple page/post password where no user login is required.
    Is there a plugin that can protect areas of a page or post independently from the wp "password system"? Would be great if you can share any knowledge. Thanks!

  13. Peter

    Just read your post on Creating Password Protected Pages in WP. When I found the plugin you mentioned – Password Protect Children's Pages – I got the following message: "This plugin hasn't been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress." I'm a real novice at this, so I don't want to do anything that will backfire on me. Any thoughts?

    1. Mark

      Peter – did you find an alternative to Password Protect Children's Pages? I notice you have a password protected section on your site so I am guessing you either went ahead with the unsupported plugin or found another way?

  14. Jeremy

    Hi !

    I find your blog absolutely interesting. And I aalso have a question which is a bit related to this topic so if you prefer you can answer by email directly.

    I have a blog, I created a new page for my online product and I would like to give each of my clients an access code, password. Each one of them a unique username and password to get to my product. I could manage to create a global passsword so I give the same to everyone but how can I create a different one for each of my customers ?
    I appreciate your time and help and thanks in advance.

    1. Sherissa R

      Did you find a solution for this setup?

  15. Mark

    I have a client that wants their WordPress site to have three areas. One unprotected, one for group A (dependent on permission to a Google Group A) and one for group B(dependent on permission to A Google Group B). Members will first get into A and then move to B. People who are in B can also see things that are in “A” and “B” areas but “A” folks should not be able to be able to see “B” area until they are in group B. If it is easier then B will see B only and A will see A only.

    ~M

    1. LucyBeer

      Hi Mark – Sounds like you will need a more robust membership solution. You could look at the "Members" plugin by Justin Tadlock, but you may also look at s2 Member which has even more capabilities.

  16. markus

    Hi Lucy,
    this afternoon I spent several hours checking out plugins, reading how-tos, activating and finally deactivating one after the other – until I found your page: exactly what I was looking for – works simple and clean. You made my day – thank you!

  17. Michael

    Great find – thank you!!

Leave a Reply to Jeremy Cancel comment reply

Your email address will not be published. Required fields are marked *