There are many use cases for password protected content in WordPress. This is especially true for content creators who create premium content to actively monetize it in the form of subscriptions or memberships.
But as it is with everything related to WordPress, password protecting posts doesn’t have to be difficult. If you’re wondering how to password protect WordPress content, posts, and even categories without having to mess around with code, then let me tell you that all you need is a flexible user management plugin like Profile Builder to get the job done in a few easy steps.
Why Password Protect Posts in WordPress?
There can be many reasons for password protecting posts in WordPress. One of the most popular reasons is membership website owners looking to restrict their premium content.
A membership website has premium content that is only sold to its premium members in exchange for a fee. It needs to make sure that its premium content is only accessible for its paid members and restricted for everyone else. The premium content here may be a premium category with all the restricted posts or a few specific tutorials posted in the form of posts.
Similarly, some WordPress websites sell a few of their posts bundled as some kind of course or try to build a user base or premium community by making a few of their important posts private. This is different from password protecting an entire WordPress website though.
Regardless of the reason, our user and content management plugin, Profile Builder Pro, is here to save the day. However, if you run a membership website and want to restrict content for non-members, then you might want to check out Paid Membership Subscriptions, which is a complete WordPress membership site plugin.
Restrict and password protect posts in WordPress in a few easy steps and do much more with Profile Builder Pro.
Profile Builder Pro
Restrict and password protect posts in WordPress in a few easy steps and do much more with Profile Builder Pro.Get the plugin
We will get into more details below as we walk you through our step-by-step tutorial for password protecting content, posts, and categories on your WordPress website.
How to Password Protect WordPress Content or Posts
Now, in order to password protect any type of content on your WordPress site, the first thing you’ll need is a way for your users to ask for access to restricted content.
This can be achieved by requesting your visitors to sign up to your site in order to view this restricted content. This way, whenever a user stumbles upon a restricted post, they will be prompted to use their username and password in order to be granted access. And this is where Profile Builder comes in handy.
Even though the paid version of Profile Builder Pro offers a wide range of content management functionalities, for this type of basic content restriction that we’re going to talk about in this tutorial, the free version of the plugin works just fine. So let’s get started!
Install the Profile Builder Plugin
Profile Builder Pro is a complete user management plugin that offers a huge range of features, including the ability to password protect certain areas of your WordPress website. You can easily restrict some of the posts on your website, or any other areas for that matter, and deny access to them to everyone who doesn’t log in with their username and password. And you can do it for free!
So, to start things off, you’ll need to download the free version of the plugin from WordPress.org and upload it to your site (Plugins → Add New → Upload Plugin). Alternatively, you can also simply search for “Profile Builder” in the search bar of the Plugins section (Plugins → Add New).
Next, install your plugin by hitting the Install Now button, followed by the Activate button.
You can now start using the password protect functionality on your site.
Create Custom Login and Registration Pages
When you’re setting up a password protected post in WordPress, you will first need to create a registration page visitors will use to sign up, and a custom login page so that returning visitors can easily log back into their accounts.
To create these pages, all you have to do is use the proper shortcodes for each. In fact, you can even create multiple registration/login pages using these same shortcodes.
Creating a custom login page with Profile Builder is extremely simple. You just need to copy the
[wppb-login] shortcode, then create a new page and paste this shortcode on it.
Now, this page will automatically turn into a front-end user login page.
The exact same process applies to the registration page, you’ll just need to use the
[wppb-register] shortcode instead.
Enable Content Restrictions for WordPress Password Protected Content
Now that you have a way for users to log in, it’s time to set up the password protected posts on your WordPress website. You can password protect as many posts as you want.
However, you’ll first need to activate Profile Builder’s content restriction functionality if it’s not already activated on your site. To do so, go to Profile Builder → Settings and then click on the Content Restriction tab.
You need to make sure the Enable Content Restriction dropdown menu is set to Yes, as you can see in the image above. For the second option – Type of Restriction – you’ll need to choose Message.
Keep in mind that these are going to be your default content restrictions settings, but you can still overwrite these settings for individual posts as well if you ever need to.
Now, if you scroll down a bit, you’ll find the section that allows you to write a message to be displayed to restricted users. Here you’ll be able to customize the message your logged out visitors will see when they try to view a restricted piece of content. But, most importantly, this is where you’ll be able to grant them access in exchange for their username and password.
As you can see above, after we’ve entered our custom message, we’ve simply added the login shortcode here as well. In our example, we’ve also included 2 extra arguments along with the shortcode, in order to help new users easily create an account or recover their password. But you can leave the
[wppb-login] as it is if you don’t want to include any arguments.
Now we just need to scroll down to the end of the page and click the Save Changes button.
Password Protect WordPress Posts
Now you can go to the posts and set them up as password protected posts on your WordPress site. Go to the specific post you want to restrict and scroll down to the Profile Builder Content Restriction section, at the bottom of the page. Let me show you an example below.
This is what we see when we scroll down to the bottom of the post we want to restrict. Now, because we have already set up the default content restriction settings in the main Profile Builder settings area, we don’t need to make any changes here except for checking the Logged In Users checkbox.
This will allow the website to ask logged-out users for a password when they land on a password protected post. So, once you’ve clicked on the Logged In Users checkbox, you can scroll back up and click on the Update button for that post.
Now, when we try to view this particular post without logging in, we are greeted with our custom message and are required to enter our username and password in order to access the post.
This is all you need to do. It’s a very simple and quick process that allows you to set up as many password protected posts in WordPress as you want in no time.
How to Password Protect WordPress Categories or Post Types
But what if you want to restrict entire post types or categories? While Profile Builder works perfectly fine if you want to password protect content in WordPress that’s in the form of individual posts or pages, you’re going to need a bit of extra help if you need to restrict entire categories or post types on your site.
And this is where Paid Member Subscriptions, one of the most complete and functional membership plugins for WordPress websites, comes in.
Set up a fully functional membership website with restricted categories and premium content with ease.
Paid Member Subscriptions Pro
Set up a fully functional membership website with restricted categories and premium content with ease.Get the plugin
Whether you wish to start a full-on membership website, or simply want to restrict some specific post types or categories, using Paid Member Subscriptions is surprisingly simple and efficient.
Install the Paid Member Subscriptions Plugin
First things first, you’ll need to purchase and then download Paid Member Subscriptions from your Cozmoslabs account page.
Make sure to download both the main plugin and the Pro extension from your account and then upload those zip files to your WordPress site.
To upload the plugin on your site, go to Plugins → Add New → Upload Plugin. Select the previously downloaded files and then install and activate them one by one.
Enable Global Content Restriction
Next, you’ll need to activate the Global Content Restriction add-on, available with the Paid Member Subscriptions Basic or Pro licenses only.
Navigate to Paid Membership Subscriptions → Add-ons, find the Global Content Restriction in the add-on list, and then activate it.
Now, if you want to password protect entire categories or post types on your WordPress website, you’ll need to set up at least one subscription plan. You can make this plan free, so users only need to sign in to access restricted categories, or you can even charge a one time or recurring fee.
This is what makes Paid Member Subscription such a great option for managing membership websites since it offers subscription plan setups bundled up with customized content restrictions and lots of membership features, all in one place.
Password Protect WordPress Categories
With that said, let me walk you through the steps you need to perform to set up a subscription plan and password protect a category on your WordPress website.
First, go to Paid Membership Subscriptions → Subscription Plans. Then click on the Add New button at the top.
You’ll land on the page where you can set up and customize your subscription plan. If you don’t want to charge users for signing up to your site, you can simply add a name to your plan and then leave all of the other setting as they are by default. But if you want to benefit from other membership features, here’s a detailed documentation on Subscription Plans and how to set them up the right way.
Next, scroll down to the bottom of the page, where you will see the Global Content Restriction section. This is where you’ll set up the password protected categories in WordPress.
Now choose the Post Type from the dropdown menu. For our use case, we’ll go with the “post” option since we want to password protect an entire post category. Next, click on the Add Taxonomy link and choose the Category option from the dropdown menu that appears.
As you can see in the image above, a list of all the categories available on our WordPress website shows up. You can choose the categories you want to restrict or password protect and then scroll back up on the page and click on the Save Subscription button.
Update the Registration Page
Now, in order for this restriction to work, there’s one more step you need to take. Remember the registration page you’ve created in the beginning using the
Well, because in order for your users to have access to this type of restricted content, they need to sign up for a subscription plan as well, you’ll need to use a different sign-up form this time around.
To do this, go back to the registration page you’ve already created with Profile Builder, and replace the
[wppb-register] shortcode with the new
[pms-register] shortcode. This new form will display a list of all the subscription plans you’ve created, right here on the registration page. In our case, we’ve only created one free tier, so all new users will be automatically subscribed to this plan upon sign-up.
Now, all the posts under the restricted category, “Simply stories” in this case, will return the set restricted message and login form, for non-logged-in users. The visitors will only be authorized to view posts from this category by using their username and password.
In order to customize the message shown here, you can apply the exact same steps you followed when setting up Profile Builder’s content restrictions. Just go to Paid Member Subscriptions → Settings → Content Restriction tab, instead of Profile Builder’s Content Restrictions this time. You can even copy the exact same message and login form here as well.
Password Protect Posts in WordPress in Few Simple Steps
After going through the above tutorial, you should now have a pretty clear idea of how to go about password protecting your posts in WordPress. And if you’re a membership site owner, then you can just as easily password protect entire categories in WordPress, or any other premium content for that matter, using Paid Member Subscriptions.
Just make sure you choose the right plugin for your needs and follow the few simple steps we explained above. You’ll then be good to go with implementing fully customized content restrictions on your WordPress website.
A complete user management plugin that lets you restrict posts in WordPress in a fully customized way.
Profile Builder Pro
A complete user management plugin that lets you restrict posts in WordPress in a fully customized way.Get the plugin
Do you still have questions on how to password protect content, posts, and categories in WordPress? Let us know in the comments!
Subscribe to get early access
to new plugins, discounts and brief updates about what's new with Cozmoslabs!