Password Protect WordPress
Themeisle content is free. When you purchase through referral links on our site, we earn a commission. Learn More

If you want to restrict access to parts of your site, you’ll need to set passwords. For example, you might want to make some posts available to subscribers only, or you might want to make certain sections of a post private. Therefore, you might be wondering how to password protect WordPress pages, posts, categories, and products on your site.

Fortunately, the process is quite simple. You can use a plugin like Password Protect Pages to boost your site’s security. In fact, this tool enables you to password protect WordPress categories, posts, WooCommerce products, and more.

In this tutorial, we’ll show you how to set up password protection for different types of content on your site, using Password Protect Pages.

🔒️ Once you finish reading, you’ll know how to password protect:

📚 Table of contents

How to password protect your entire WordPress site

Password Protect Pages provides partial and sitewide protection. The latter enables you to restrict access to your entire website.

After installing and activating the plugin, look for Password Protect WordPress in the dashboard and select Sitewide Protection. Then, turn on the toggle switch for Password Protect Entire Site:

Sitewide Protection for WordPress option inside the Password Protect WordPress plugin.

Next, you’ll need to enter a password. When you’re ready, hit Save Changes:

Choosing to password protect entire WordPress site inside the Password Protect WordPress plugin.

Now, when someone visits your site, this is what they’ll see:

Front-end of WordPress after activating sitewide protection.

Of course, you can now customize the login form so that it aligns with your branding. To do this, open the WordPress Customizer (Appearance > Customize) and select PPWP Sitewide Login Form:

Customizing the WordPress password form.

Here, you can add your own logo, change the button colors, and more:

Creating a custom sitewide login form by adding a logo.

Remember to hit Publish to save your changes. If you change your mind about password-protecting the entire site, simply return to the Sitewide Protection page and turn off the toggle switch. 

Alternative solution: If you’d like to try a different plugin, Password Protected can help you achieve the same thing. It enables you to secure your website with a single password.

How to password protect WordPress categories

You might choose to password protect WordPress categories. For example, you might want to make any posts categorized under “Digital Marketing” available only to subscribers.

Once again, you can use Password Protect Pages for this. Navigate to Posts > Categories and simply move the toggle switch to “on”.

You can then select the categories you want to make private and set your password. Finally, click on Save Changes:

Password protect categories using the Password Protect WordPress plugin.

Then, you can go to the WordPress Customizer to customize the password form. This time, however, you’ll need to select PPWP Single Password Form.

How to password protect WordPress posts and pages

Password Protect Pages also enables you to password protect WordPress posts. To do this, click on Password Protect WordPress > Settings and select the Master Passwords tab:

The master password screen inside the Password Protect WordPress dashboard.

Now, click on Add New. This will launch a popup window. In the field provided, enter your password. In the Label field, you can add a name for reference.

For Post Types, select Posts:

Adding a new password inside the Password Protect WordPress plugin

If you want to apply this password to everyone, make sure the Type field is set to Global. If you want to apply it to specific roles only, choose Roles and make your selections. 

Finally, click on Add New. Now, navigate to the Posts page and hover over the post you want to make private. Here, you’ll see an option labeled Protect:

Showing what the password protected page looks like in the WordPress dashboard.

Click on it and you should see an orange “protected” label. Now, visitors will need to enter the password you set earlier to access this post.

To password protect WordPress pages, simply follow the same process.

How to password protect only specific sections of a public page or post

Sometimes you don’t want to password protect a WordPress page, but only sections of it. The good news is that this plugin also enables you to password protect parts of a page or post, using the following code:

[ppwp passwords="password1 password2" whitelisted_roles="administrator, editor"]
Your protected content
[/ppwp]

Open the page or post you want to partially make private. Then, find the piece of content you want to password protect, and right above it add a Shortcode block:

Shortcode block inside the WordPress Block Editor.

Enter the following code and adjust it accordingly:

[ppwp passwords="password1 password2" whitelisted_roles="administrator, editor"]

For example, you’ll need to replace password1 and password2 with the label you created for your password. If you want to apply this password to everyone, you can remove the whitelisted roles from the shortcode. 

Now, go to the end of the content you want to protect, add another Shortcode block, and simply enter the following line:

[/ppwp]

Here’s an example:

Using shortcode blocks to partially protect content in WordPress.

To check that you’ve done this correctly, visit your page or post on the front end and scroll down to the protected content. You should see a login form with a message:

The front end of a partially password protected WordPress post.

Remember that you can customize the login form in the WordPress Customizer. 

Alternative solution: Passster is another plugin that enables you to password protect WordPress posts (or parts of them). 

How to password protect WooCommerce products

Finally, let’s look at how to password protect WooCommerce products. Unfortunately, this feature is not available in the free version of Password Protect Pages – you’ll need to upgrade to the premium plugin to access it.

However, WooCommerce has a built-in password protection feature for products. Go to the Products page in your dashboard and click to open the item you want to create a password for.

In the Publish box, you’ll see a few options for Visibility. Select Password protected and enter the password: 

Editing a WooCommerce product to change the privacy settings.

Then, click on OK, followed by Update. Now, users will see the following message and login form when they visit that product page:

The front-end of a password protected WooCommerce product.

This feature can be very useful if you want to make certain products available to particular clients only. 

Wrapping things up 🤓

If you want to make some of your content available to certain readers or clients only, you’ll need to password protect your content. This way, only users with access to that password can view your posts or products.

In this tutorial we showed you how to use the Password Protect Pages plugin to accomplish the following:

  • Password protect an entire website
  • Password protect WordPress category pages
  • Password protect a WordPress page or a post
  • Restrict access to specific sections of an otherwise public page or post
  • Password protect WooCommerce products

We also gave you some alternative plugin options for some of those specific actions, but the Password Protect Pages plugin is your best bet because it is the most comprehensive choice currently available.

💡 If you found this article helpful, you might also want to read our tutorial on how to create gated content in WordPress. It’ll give you some additional ideas on protecting your content.

Do you have any lingering questions on how to password protect WordPress? Let us know in the comments section below!

Free guide

4 Essential Steps to Speed Up
Your WordPress Website

Follow the simple steps in our 4-part mini series
and reduce your loading times by 50-80%. 🚀

Free Access

Or start the conversation in our Facebook group for WordPress professionals. Find answers, share tips, and get help from other WordPress experts. Join now (it’s free)!