Create Username and Password protected pages/posts


I would like to create 4 username and password protected pages on my website, and I'm not sure if Membership is the right plugin to use. I have a few questions.

I want my whole site visible except for these 4 pages:

SEB Committee
Finance & Lending Committee
Board of Directors
Operations Committee

Ideally, the member would click on login, and then be directed to the password protected pages/posts, where they could download the previous meetings minutes and other documents.

So going through the instructions:

1. Plan

2. Categories:
1. SEB
2. FL
3. BOD
4. OP

Do I need to create a level for regular site visitors that gives them access? By enabling Membership will that stop everyone from regular site visitors from seeing the site?

3. Shortcodes - not really needed unless I merge all content onto one page (which might make navigation easier for users with multi level access) - Should I have all the downloads on one page?

4. I made a no-access page

5. I will register users. No self registration neccessary

6. Wordpress registration is disabled.

7. Download groups. - Is this necessary for all downloads on the site? If I don't set this up what will happen?

8. Levels. My question with this stems from step 2. Do I need to create a level for regular site access?

9. No subscriptions.

10. No payment gateways needed.

11. Enable.

So what is the easiest way to set this up? Is Members the best plugin for this?

Thanks for your help.


  • fitoussi

    Hi BergMedia,
    i needed few protected pages for my site but i didn't want to use the Membership plugin just for that so i found a simple way to do so. i don't know if it will be helpful for you but that is what i did.
    the protected pages are template files so i opened them and added:

    <?php if ( is_user_logged_in()) { ?>

    to the top of the page and :

    <?php } else {
    	wp_redirect( "http://url to direct user if is not logged in); } ?>

    to the very bottom.
    now when user is not logged in and trying to access the page he will be sent to my logged in page.
    i just did it a while ago and i am really not sure if this is a good or safe way to protect a page but as i am testing it now it does do what i want it to.

  • DavidM

    Hi Kelly and welcome to WPMU DEV!

    To start with, you mentioned those initial items would be Pages. Is that correct? If so, you wouldn't be able to use Categories or the Category Rule for them as Pages don't have Categories.

    If you're using Posts, then Categories will definitely work well for you.

    Download Groups isn't totally necessary but if you'd like to mask the download area to restrict access to your download files, you'll want to use this. Otherwise, your downloads themselves will be publicly accessible via their urls. However, if your members don't share or expose those urls somehow, they won't exactly be known about apart from members.

    Whether or not you have all your downloads on one page will be up to you. It might make it easier to manage having them in a single page.

    For regular site access, you'll likely want to create a basic level and specify that level as Stranger in Membership > Edit Options. You can then customize how logged out users see your site.

    Hope that helps, let us know if you have further questions!


  • Jonathan


    If you want to protect only 4 pages then yes membership plugin is overkill. Especially if no gateways are needed. So I would say @fitoussi suggestion is probably the best. You could even use a variation of fitoussi suggestion and code up a nice shortcode that would be used like this [member]hidden text[/member] on those pages.

    Also another great plugin is the password protect selected content plugin.
    You could password protect those pages content - and have the users(I presume are employees etc) assess those pages by means of password.

    And if you decide on the membership plugin, then @DavidM covered that nicely :wink:

  • BergMedia

    Thanks for your help.

    I set up the Membership plugin, but the client didn't like it (and I too) that I had to go in and approve every post and page that where created for the "stranger" level.

    @fitoussi - a good solution but I need to have different levels of access for different users, and they need a username AND a password for security.

    Membership is a great plugin but not exactly what I was looking for. I think I might just set up a free account over at BaseCamp from 37 Signals to host the files.

    Thanks again for your help.


  • fitoussi

    same way you can also deny access by user role ( i believe you can) for example:
    on top of the page enter:

    if ( is_user_logged_in()  && current_user_can('administrator') ) {

    and in the end of the page:

    <?php } else {
    	wp_redirect( "http://url to direct user if is not logged in); } ?>

    this way (didnt try it but i think it should work) only logged in administrators can see the page. and you can change "administrator" to different user roles.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.