Looking for a way to password protect WordPress? There are many different ways you can add password protection to your website, from password protecting your entire WordPress site, just a specific piece of content or even just a part of Other public content.
How to Password Protect Your Entire WordPress Site
If you want to password protect your entire WordPress site, you have two main options:
- A charger
- HTTP authentication at the server level
Among them, the plugin method is definitely more user friendly and better for user-oriented websites, while HTTP authentication is an effective method to protect staging website passwords or non-website types. other users.
How to Password Protect WordPress Website with Plugin
To password protect your entire WordPress site, we recommend it Free Password Protection plugin from Ben Huson, is appreciated and available at WordPress.org.
When you install and activate the plugin, you can access Settings → Password protected to configure the plugin's settings.
Check the Password protected status box to enable password protection and enter the password you want in the New Password box.
Another interesting thing about the plugin is that it also gives you the option to whitelist certain types of users / requests, as well as IP addresses. You can configure these if you want:
How to password protect your entire WordPress site
When you enable it, anyone who tries to access your site will need to enter a password in the shortened version of the WordPress login page:
Sample sitewide password
If you want to change the login page logo from the general WordPress logo, you can use it Logo login plugin for free .
How to password protect WordPress website with HTTP authentication
With basic HTTP authentication (also known as htpasswd protection), you can add an extra layer of password protection before people can even load your website, which is why it creates A great choice for staging or developing websites.
Turn on .htpasswd protection
After it is activated, your WordPress site will require authentication to access it. You can change your login information at any time or disable it when you no longer need it.
authentication prompt .htpasswd
How to password protect a folder
Need password protected folder on your website? Perhaps you have a directory outside of your WordPress installation that you don't want the public to have access to.
To set up manually, you will first need to create a .htpasswd file. You can use creation tool This handy. Then upload the file to a directory you want to protect.
www / user / public / protecteddirectory
Then create a .htacces file with the following code and upload it to the path of the folder you want to protect. Make sure you update the folder path and username.
AuthName "restricted area"
If you are running Nginx, you can also restrict access with HTTP basic authentication. Check this guide .
If you host with a provider with cPanel, you can set up a password-protected folder with the Directory Security tool of the Directory, located in the Files section.
cPanel directory privacy
How Password Protect Woo Trade Post, Page, and Products
If you want to password-protect a WooCommerce post, page, or product, WordPress actually includes an integrated feature to help you set this up through its Display settings.
You will find the Display setting in the WordPress editor, so you can use it for every type of content we mentioned above, as well as any other custom post types you may be using. Use at his website.
- Open the WordPress editor for the content you want to add password protection for.
- Find the Display option in the sidebar on the right.
- Click on it.
- Select Password protected and enter the password you want to use to unlock the post.
This is what it looks like in the new WordPress block editor:
Where to find Display options in the block editor
And this is what it looks like in the older Classic WordPress editor:
Where to find the Display settings of WordPress
When you publish or update the content, visitors will be prompted to enter their password before they can view the post. In addition, WordPress will pre-register Online Protection before the title of the post:
How integrated WordPress password protection works
An interesting fact about this method is that you can actually allow people to unlock multiple posts by entering a one-time password. To set this up, all you need to do is reuse the same password on multiple posts. Easy, right?
When a visitor enters a password once, it will automatically unlock all content using the same password. However, if another piece of content uses a different password, the visitor will still need to enter that unique password.
Finally, to give you an idea of how this type of password protection might work for another piece of content, here's how it works with WooC Commerce products. You can see the Display controls showing right at the same location:
How to protect WooC Commerce product password
How to Password Protect WordPress Posts Catalog
Instead of password-protecting individual content, you can also password-protect the entire catalog.
The downside of this method is that it makes it easy to add password protection to many pieces of content and it is also simpler for your visitors because they only need to enter the password once to unlock all content. in that category.
To set this up, you will need plugin help. We recommend two options:
How to use the list is password protected
The list is password protected works by basically adding the Password protected feature you saw in the above section to your catalog.
When you install and activate the plugin, you can go to Posts → Categories and edit the category where you want to add the password. At the bottom, you should now see the same Display box you used to password protect each piece of content.
Select Password protected and enter your desired password.
Another great thing is that the plugin allows you to add multiple passwords, each of which unlocks the category. This allows you to give each person / group a unique password, making it easy to remove future access if needed:
How to add a password to the catalog
When you save your changes, visitors will be prompted for a password whenever they try to access a post in a password-protected category:
Password form to unlock categories
By going to Settings → Protected Categories, you can also access some additional settings that allow you to control the functionality of the plugin. You can:
- Set an expiration for the password (for example, the time to unlock the content before the visitor needs to reenter the password).
- Choose whether or not to display content in protected categories in public areas on your site or whether to hide them completely until someone enters a password.
- Customize the login form you saw above.
Catalog settings are password protected
If you run a WooC Commerce store, the same developer also has a similar plugin designed to work with WooC Commerce called WooCommerce Protected Category .
How to use access list password
Password access catalog Available for free at WordPress.org. When you install and activate it, you can access Settings → Access password list.
There, you can:
- Choose a password to use.
- Choose a category to protect your password.
- Whitelist certain user roles so they can view hidden directories without entering a password.
- Choose whether to make the snippet public or hide everything.
- Customize the login page / password protected message.
Access Directory password settings
When you save your changes, visitors will need to enter their password when they try to access any of the restricted categories.
While this plugin is free, one drawback is that you can only enter one password and you must use the same password for all categories where you want to protect the password.
If you want to use different passwords for each category, you might be better off with the password-protected Categories plugin above.
One difference is that the Protected Access List still displays the post title even before a user enters a password, while the Password-protected Categories plugin above hides the title:
Access the Password pattern
How to password protect part of a WordPress post
Finally, take a look at the most specific way to password protect only part of another public WordPress post.
To set up this function, you can use Free Passster plugin at WordPress.org .
When you install and activate the plugin, go to Settings → Passster to generate the shortcode you will use to restrict your content.
Enter your desired password and select Create password:
Passster shortcode generator
Then save your changes and copy the short code that Passster provides you:
Copy the shortcode Passster
Then, add this shortcode to the content you want to use password protection. Alternatively, edit your content here Reserve your place and replace it with the content you want to protect with a password:
Example of short code Passster
When you publish your post, here's an example of how the default password protection looks like:
Passster login form
To customize the look and feel of this form, you can use the WordPress Customizer (Interface → Customize).
Find the Passster section in the WordPress Customizer. There, you will be able to customize the form's text and colors:
Passster style options in WordPress Customizer
Need a password to protect an entire blog post or just a part of it? Perhaps a single category with all the content in it? Check out our latest tutorial on how to do it ... it's easy! 🔐💪Press HERE TO TWEET
Whether you want to restrict access to your entire site, a piece of content or something in between, you have lots of options on how to password protect WordPress.
Choose the approach that works best for you, follow the steps in our guide and enjoy your new WordPress password protection.
Do you have any questions about how to password protect a WordPress website? Leave a comment and we will try to help.
CEO - Founder of Compa Marketing. Specialist with over 5 years of experience in the field of Digital Marketing, SEO / SEM in Vietnam and the world.