Recently I had the need to set up a couple of blogs that I only wanted people who are logged in to be able to access. After a little research and experimentation I came across the following fix.

So lets say you wanted to set up a Blog for just the use of your own internal company. Or Family. Or whatever… But you don’t want anyone to be able to access the site unless they are logged in. It’s actually a lot easier than you think. Here’s how to do it.

  1. In the WordPress Admin panel choose Settings. This takes you to the General Settings tab. Under Membership, UNCHECK the option that reads “Anyone can register“.

    This way the only people who are going to have access are the ones that you allow to register. Bad news = You have to register them. Good news = Only they will be able to log in.

  2. Under the Appearance link in the Admin panel choose Editor. This will take you to the “Edit Themes” tab. On the right side of the screen you should see a file called Header.php which is located in your theme directory. Look for the line that says <body> then place the following code immediately after it:

    <?php if (is_user_logged_in()){
    echo "";
    }
    else {
    auth_redirect();
    };
    ?>
  3. At this point, you should be able to save the modifications to the Header.php file and you should be done! HOWEVER, you might run into a situation where you see the following message at the bottom of the page:

    You need to make this file writable before you can save your changes.

    If that is the case, you are going to need to use an FTP program to change the permissions on the file before you can edit it.

Good luck and hope this helps!

Twitter Comments

OriginalVlatte RT @johnpoz: Tutorial: Password Protect an Entire WordPress Blog http://onemansblog.com/wppasswords
Re-Tweet | Reply | View Tweet
web2feed RT @aj_wood: (via @johnpoz) Tutorial: Password Protect an Entire #WordPress Blog - http://onemansblog.com/wppasswords
Re-Tweet | Reply | View Tweet
twitanium RT @aj_wood (via @johnpoz) Tutorial: Password Protect an Entire #WordPress Blog - http://onemansblog.com/wppasswords
Re-Tweet | Reply | View Tweet
aj_wood (via @johnpoz) Tutorial: Password Protect an Entire #WordPress Blog - http://onemansblog.com/wppasswords
Re-Tweet | Reply | View Tweet
johnpoz Tutorial: Password Protect an Entire #WordPress Blog - http://onemansblog.com/wppasswords
Re-Tweet | Reply | View Tweet
Tags: , , ,

Related posts

  1. Protect WordPress from Hackers – Secure that Beeotch!Dammit!!!! I HATE SPAMMERS MORE THAN ANYONE ON EARTH! I honestly, 100% mean it when I say that I want...
  2. Tutorial: Make More Money with WordPress, Social Media and AnalyticsOn January 30, 2010 I did a lecture for the DFW WordPress Meetup group which we called, “Make More Money...
  3. One Man’s Blog 1 Year Anniversary!Wow, has it been a year already?!? My inaugural post came on July 23, 2006. I didn’t really have a...
  4. Customize the Wordpress Login Screen in 10 StepsTo my normal readers… sorry, but this post is not for you. I’ve been asked technical questions by several people...
  5. Tutorial: How To Put Ads on WordPress Home Page OnlyFolks, since my site has gotten fairly popular I have people who want to advertise on the home page. The...
  6. Tutorial: Howto Increase the Number of Comments Visible in WordPress EditorFolks, I get a lot of comments here on One Man’s Blog (nearly 7,000 at this point). Often there are...
  7. Tutorial: Add 3 Centered Columns to Wordpress FooterThis post describes how to add variable width, centered columns of stuff to the Worpress footer. Not sure what I...