A comprehensive database for everything WordPress related.

TOP
WPKlik Logo Newsletter

Sign up and receive a free copy of How to Create an online Store with WooCommerce (full guide)

How to Password Protect Your WordPress Site, Specific Page or Part of a Page

How to Password Protect Your WordPress Site, Specific Page or Part of a Page

The moment you decide to create a website implies that you are going to share a lot of what matters to you with the whole world. But that doesn’t mean you have to share everything with everyone. It may seem counterintuitive, but there are times when you’ll want to restrict access to your WP site by protecting it with a password or by making a specific page or entire site private. You can do this in a variety of ways and one of the most reliable and commonly used is to password protect your site, specific pages, categories, or parts of the page. Some types of protection will require the use of a third-party plugin, while others are offered within core WordPress functionalities. You certainly can have a lot of control over who and why can see your content.

In this article, you’ll learn why it is sometimes a good idea to restrict access to your content and we will show you how you can easily password protect your whole site, specific pages or posts, specific content categories, or just a specific segment on a page:

Why is it a Good Idea to Password Protect Your Site?

If you are thinking, what’s the point of creating a site if you’re gonna hide it from the public view, you’re in for a surprise. There are a number of situations when this is not only a desirable solution but also a very necessary one.

For example, if you are launching a new product and you’re in search of investors who would support you, having a website is a great way to educate them. But you can’t go public with the website about a product that isn’t yet produced. On the other hand, full-fledged website gives you much-needed legitimacy and improves your chances of acquiring the support. Therefore, if you create a website and password protect it, you can show it to your potential sponsors and after you get the needed support you can go public, without wasting time on creating a site from scratch.

Other reasons for protecting the whole site may be that you want to create a kind of private online place for a group of friends or family, or you simply need more time to evaluate the content and decide whether to make some changes or not.

Artists who create original content often use this functionality for private sales websites. It is also an excellent solution for private company operations and communications when a company needs to restrict access to employees only.

In case you don’t need to restrict access to the whole site you can add password protection only to some pages. This is an excellent solution when you have some type of exclusive content on your site, like a premium educational course, or a diet plan, or a recipe, or a photo collection that you want to share only with selected audience.

In cases when you only need to protect a specific type of content like photos, or documents then the option you might want to employ is to password protect specific categories of content. This is a reasonable in-between solution that gives you a lot of control and doesn’t block all users from your website.

The reasons why you may want to hide only specific parts on the page may also be very diverse. For example, if you are sharing personal data, confidential info, or similar, it makes sense to password protect only that specific bit of the content of the otherwise public post. It may also be a way of showing how professional and serious you are about the content that you share.

How to Password Protect the Whole Site

WordPress doesn’t come with the in-built functionality for protecting the whole site, but you can do it in a few easy steps with the help of a plugin. Our choice is the Password Protected plugin because it is reliable, easy to use, beginner-friendly, and efficient. The Password Protected plugin enables you to protect your entire site with a single password without the need to go into your control panel or web hosting. It also allows you to leave unrestricted access to site administrators and to allow access to feeds.

Password Protected Plugin

The installation process is very simple, and when it is done you will find the plugin in the Settings > Password Protected.

Password Protected plugin settings

When you click on it you will see all the options that are at your disposal. You can allow access only to administrators or only to logged-in users, or both, or none. There are cases where all of the above make sense. You can also check the Allow RSS Feeds, or Allow REST API Access options. And after you check all the options that suit you, remember to also check Enabled, so that the changes you made can come into effect.

Protect your website

When you entered all your settings, you will notice the green sign with a padlock:

WordPress website password saved

This is how the frontend will look like when someone tries to open the protected content:

Password login

How to Protect a Post/Page with a Password

If you are using the Classic WP Editor or Gutenberg, you will notice the option to add protection in the Publish meta box on the right side of the post.

This is where you will find this option in the Classic WP Editor:

Password protect page or post in Classic editor

You can see the same option in Gutenberg, you simply enter the password for the page/post that will then be applied only to that specific page/post.

Password protect page or post in Gutenberg editor

The result in the frontend looks like this for someone who tries to open the page:

Password protect page

In case you want to change the default message “This content is password protected. To view it please enter your password below” and customize it to blend with your site’s overall style, you can easily do it with the help of another plugin: Change Password Protected Message. This is a very simple plugin, with all the options listed in one page so there’s no doubt you’ll find it very easty to use.

Change Password Protected Message plugin

After the installation you can access it in Settings > Reading – you will notice a field where you enter the custom message.

Change Password Protected Message settings

And here you can see how the screen will look from the user’s point of view:

Change password message

As for the Elementor, the free version doesn’t come with built-in functionality for adding protection, but the premium version includes it. Some of the Elementor addons can also provide you with this functionality. And, there’s also the possibility to open the page built in Elementor, with another editor and then set password protection in it.

How to Password Protect Categories

WordPress doesn’t include this functionality but you can use a variety of tested plugins. Our choice is the Access Category Password because it is easy to use and provides you with plenty of practical features. You can protect more than one category with it, style the password form, and a lot more in just a few clicks. Plus, this excellent plugin is totally free.

Access Category Password Plugin

After the installation, you’ll find it in Settings > Access Category Password. You will be amazed at how many options you have, and how easy it is to activate them. Just like in the Password Protected Plugin, all the options are listed on one page:

Access Category Password settings

Let’s see what some of them mean, though they are self-explanatory in the majority of cases:

The Password box is where you set the password that will protect the categories that you check below.

In the Impacted categories you set which categories will have restricted access. Simply check the box for each category you want the password protection to apply to.

Granting users option allows you to choose user roles that will have granted access, without the need to enter the password.

Only single post – you will need this option only if you want the post content to be displayed on your archive pages or your homepage. Only the single post page of posts in the restricted categories will have restricted access. This is not a commonly used option, and usually should be left unchecked.

What’s important to know is that you can configure the message that will show above the password field. You can also configure the text for the button and style the look of the page with a custom CSS.

This is an example of a customized screen that shows up when someone tries to open any post or page from the password protected category.

Protected category

How to Password Protect a Part of the WordPress Page/Post?

In cases where you only need to add password protection to a specific part of the content but want to avoid having to restrict access to the whole page or post, third-party plugins offer simple solutions. We wanted an efficient and reliable plugin that is beginner-friendly and simple to use so we opted for the Passster – Password Protection plugin. It enables you to protect your content with custom shortcodes. If you are a beginner and the idea of creating a custom shortcode sounds frightening, don’t worry, it’s much simpler than it sounds, and we’ll take you through the process step by step.

Passster Password Protection Plugin

The Passster plugin allows you to add password protection to pages both in the Classic and Gutenberg Editor:

Passster page protection

The plugin includes options to password protect whole pages too, but we found it most handy in cases where we need to password protect only parts of the post or page.

The procedure is basically the same whether you use the Classic or Gutenberg Editor. All you need to do in both cases is to add a shortcode that includes the part that you want to be password protected.

[passster password="123"]your hidden content[/passster]

This is an example of how to password protect a part of the post/page in Classic WP editor. You need to enter your desired password between the quotation marks, and in this example, we wanted to restrict access to an image:

Add password code

This is how the screen looks when someone without a password tries to open it:

Password protected area

After the password is entered – the image shows up:

Protected image

You can also use the math captcha shortcode:

[passster captcha="true"]your hidden content[/passster]

This is a very interesting option – it offers a simple task containing random numbers and the sum of those numbers is a password.

Captcha shortcode

The premium version can make it all even more interesting. It includes the ReCapthca option that uses the Google v3 ReCaptcha API and implements a hidden captcha. To use it, you also need a valid Google ReCaptcha key. The premium version also allows you to use more than one password by modifying your shortcode and introduces password lists to make managing multiple passwords easier.

What is also very convenient with this plugin is that you can customize the text for headlines, error messages, buttons, instructions, and similar simply by overwriting it with a specific shortcode that will include the customized text.

Parameters for texts

This is how it looks in the frontend:

Change texts

You can also customize the look and feel of the specific pages with Passster. After you access the customizer in your WP (Appearance > Customize), you’ll find a section called Passster. When you click on it you will see three different sections: General, Form Instructions, and Button. All the changes you make here will apply to all page protections and shortcodes unless you overwrite them with the parameters shown in the shortcode.

You can customize a lot of things, from general settings like the background color, padding, and margin to modifying form descriptions, error messages, headlines, design of the buttons and hover appearance. And, since Passster uses the live mode, you will see all the changes you make immediately on the right side.

Customize Passster plugin

As for the Elementor, the first thing you need to do is to activate Elementor in the Passster plugin settings, and then the plugin will show up in the Elementor Editor:

Passster Password Protection and Elementor

As you may notice, the Visual Composer uses the PRO version, there’s no free version for this editor.

An element shows up in the Elementor:

Passster Elementor Element

In this case, everything is set simply and easily, without having to use the shortcodes, you simply enter the required data:

Protection in Elementor

The second step is where we assign the protected content.

Add protected content in elementor

The frontend looks similar to the frontends of other editors:

Password protected area

In Conclusion

As you noticed, if you want to password-protect individual WP posts, you can use the built-in WP password functionality, but in all other cases, you’ll need third-party plugins. The ones we recommended in this article are all free, tested, and user-friendly.

Knowing that you can protect your content in a variety of different ways will probably inspire you to publish more, not less. It could also motivate you to use your content in a different way. Protecting specific pages, posts, categories or pats can definitely add an air of exclusivity to your site, so use these functionalities wisely.

We hope this article was helpful. If you liked it, feel free to check out some of these articles as well!

Newsletter

WordPress perfection at your fingertips.

If you enjoyed this article, feel free to subscribe to our newsletter using the form below. You can also follow us on Facebook and Twitter and subscribe to our YouTube channel for WordPress video tutorials.

Leave a Reply