Password Protecting WordPress – Only Registered Users

I have a client who asked to have his WordPress CMS site password protected until he is ready to go live with the new business.

There are several ways to accomplish password protecting a WP installation and this is just one method I found. It password protects the site but makes it available to registered users only.  I thought this method was really easy and it can all be accomplished within the dashboard (if your theme files are editable).

Let’s get started by logging into your dashboard then make the changes listed below.

  • Settings > General: “Anyone can register” should be unchecked
  • Settings > Discussion:  Disallow “Attempt to notify any blogs linked…” and “allow link notifications from other blogs…”
  • Settings > Privacy:  Block search engines
  • Appearance > Editor > Theme Functions (functions.php):  add the following code

function password_protected() {
if ( !is_user_logged_in() ) {
add_action('template_redirect', 'password_protected');
add_action('do_feed', 'password_protected');

  • Users > Add Users who you want to have access to your site

There you have it,  a simple method to password protecting your WordPress CMS or blog.

One Response to “Password Protecting WordPress – Only Registered Users”

  1. Nagarajan says:

    That was the simplest method to protect a blog i have ever seen. Great.

Post Comments, Questions and Feedback