• Home
  • About John P.
  • Contact
  • Terms

One Man's Blog

Specialization is for Insects.

  • 10 Best
  • Art
  • Computing
  • Fun Stuff
  • Gadgets
  • Videos
  • Photography
  • Travel
  • Tutorials
  • Health & Fitness
  • Politics
  • Thoughts
  • Food
  • Reviews
  • 10 Best
  • Art
  • Computing
  • Fun Stuff
  • Gadgets
  • Videos
  • Photography
  • Travel
  • Tutorials
  • Health & Fitness
  • Politics
  • Thoughts
  • Food
  • Reviews
Home / Tutorials / Tutorial: Password Protect an Entire WordPress Blog

Tutorial: Password Protect an Entire WordPress Blog

John P.

December 27, 2009 By John P.

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!

Related

Filed Under: Tutorials, Wordpress Tagged With: Passwords, Security, Tutorials, Wordpress

About John P.

John P. is a former CEO, former TV Show Host, and the Founder and Wizard behind Texas Metal Works. You can find him on Twitter, Facebook and LinkedIn. Feel free to send shoutouts, insults, and praise. Or Money. Money is good.

Comments

  1. Chris says

    September 17, 2010 at 11:04 pm

    Thanks for posting this..I just had an irate customer telling me their site is appearing in google before it was finished..Problem solved!

    Chris

  2. John P. says

    February 7, 2010 at 3:28 pm

    That is a great question! I hadn’t actually tried it so I’m not sure. If anyone else figured it out please let us know.

    John

  3. beemsterman says

    February 6, 2010 at 4:28 pm

    Will people still be able to access rss-feeds?

  4. Filmare nunta says

    January 7, 2010 at 10:16 am

    Thanks for the share !

  5. Gouri says

    January 7, 2010 at 12:50 am

    Thanks for the post. I was under the impression that we have the password protect option for the self-hosted blogs as well.

  6. Rishabh Agarwal says

    December 31, 2009 at 1:28 pm

    Indeed Valuable. Thanks for the share :)

  7. Zig Baird says

    December 29, 2009 at 9:57 am

    A few months ago I decided to make one of my blogs totally private for family only. I did something similar to what you described above but, like you said, I had to register everyone.

    I found a nice plug-in named Absolute Privacy that does the following (straight from the author’s site):

    “Force registrants to enter first and last name
    Allow registrants to choose their own passwords
    Moderate users: new registrants cannot login until approved
    Get emailed every time an approval is waiting (with a link for quick approval)
    Lock out all non-logged in views from your website (configurable)
    Prevent subscribers from viewing admin pages (like their profile page and the dashboard)”

    I find it easy to setup and it works for my purpose. Just another alternative for your readers. The plugin can be found at:

    http://www.johnkolbert.com/portfolio/wp-plugins/absolute-privacy/

    and can be downloaded from WordPress.org at:

    http://wordpress.org/extend/plugins/absolute-privacy/stats/

John P’s Tweets

Tweets by johnpoz

Read Over 2,500,000 Times

  • How I'd Hack Your Weak Passwords
  • Amusing Little Helicopter Game
  • A Compendium of 150 Monty Python Sketches
  • 10 Worst Drivers Ever Caught On Video
  • Get Your Virtual Haircut and Other Auditory Illusions
  • How Crack Cocaine is Made

Copyright © 2023 · Local Media on Genesis Framework · WordPress · Log in

 

Loading Comments...