How to Password Protect an Entire WordPress Site

how-to-password-protect-an-entire-wordpress-site

Password protect your entire WordPress site

Want to keep your WordPress site away from prying eyes?! It’s really easy to password protect your whole WordPress site.

Simplest method  – “Password Protected” plugin

You just need this plugin: https://wordpress.org/plugins/password-protected/

With a couple of clicks you can protect your whole site. The settings screen is below, it’s very simple to use:

how to password protect your whole wordpress site

You can allow admins to see the site if logged in, so that you can still work on your site while it’s blocked from the outside world, or you can allow access by IP address.

From the front end, a non-admin would see this:

Password Protected in action

Once the correct password is entered a cookies is set in the user’s browser that will keep them “logged in” until the cookie expires or they delete it.

Note that you may have issues using this with caching. But if your site is protected like this, it’s likely in development and therefore caching isn’t really necessary.

Htpasswd Authentication

If you’re looking for something slightly more robust, you could try the htpasswd method. You can usually do this really easily from your hosting control panel. Here’s how you do it using the Siteground cPanel, but the process should look very similar on other hosts.

  1. Login and look for the Password Protect Directories icon.
    cPanel- password protect directories
  2. Select the site you want to protect, by choosing its main folder:
    folder name
  3. On the next screen fill out all the details to set up a user name and password:
    security settings
  4. You’re done! This is what it will look like when someone tries to access your site:
    Authentication required

The method described here is for simple protection, usually used when a site is in development. If you need fully-featured user access to paid-for content, you’ll need a membership plugin. My preferred one is MemberPress:

Memberpress - WordPress membership plugin
These posts may float your boat:
Read the guide on Getting Started with MemberPress
Creating password-protected areas in WordPressSee this guide
Would you like to show custom content on your password protected page? See this guide