Need to password protect WordPress? Whether you need to password protect your entire site or just a few individual posts (or something in between!), I’ve got the solutions for you in this post.
Once you finish reading, you’ll know how to password protect:
- Your entire WordPress site
- Specific categories of your site
- Individual posts or pages
- Individual WooCommerce products
- Specific content inside an otherwise public WordPress post
So whether you want the whole kit and kaboodle or just a single post, you’ll learn it here. Let’s jump in…
How to password protect your entire WordPress site
If you want to password protect your entire WordPress site, you’ll need a third-party plugin to get things done. After playing around with a number of different ones, I’ve settled on Password Protected by Ben Huson:
To use it, install and activate the plugin like you would any other WordPress plugin. Then, head to Settings → Password Protected.
All you need to do is configure the following page to password protect WordPress:
Here’s what everything means:
- Password Protected Status – when enabled, your site is password protected.
- Protected Permissions – if you check one of these boxes, visitors with those permissions will not need to enter a password. They’ll just see your site like normal.
- New Password – enter the password you want to use for your site.
- Allow IP Address – if you enter an IP address here, anyone visiting your site from that IP address will not need to enter a password.
Once you click Save Changes, anyone who doesn’t fit one of the access rules you defined will see this screen before they can access your site:
If you’d like to customize this page’s styling, you can do it the same way you’d customize the normal WordPress login page.
Note – if someone has a direct link to an image or file on your server, they’ll still be able to access that file. The password protection only affects your actual WordPress site.
How to password protect WordPress categories
Not ready to password protect your entire site? If you want something a little less drastic, you can use a different plugin to password protect specific categories of posts on your site. For this approach, you can use Access Category Password:
Once you’ve installed and activated the plugin, head to Settings → Access Category Password.
Like Password Protected, there’s only one page of settings:
Here’s what everything means:
- The password – self-explanatory! The password users will use to access restricted categories.
- Impacted categories – check the box for each category you want the password to apply to.
- Granting users – user roles for which you check the box will not need to enter a password.
- Only single post – if you check this box, post content will still display on your archive pages or your homepage. Only the single post page of posts in the restricted categories will be password protected. The default should be to leave this unchecked.
And below those options, you can also configure the various messages that will appear on the Enter password form. Speaking of which, here’s what users will see if they try to access a post from a restricted category:
How to password protect WordPress posts or WooCommerce products
If you want to password protect individual WordPress posts, pages, or WooCommerce products, you don’t need any third-party plugins. WordPress actually has a built-in function to help you accomplish this.
Just head to the WordPress Editor for a post, page, or WooCommerce product you want to restrict. Then, under Publish, click Edit for the Visibility option:
Choose Password protected and enter your desired password. Then click OK:
When you Publish or Update your post, it will be password protected and look like this:
Because this is a core WordPress function, the process is identical for pages, WooCommerce products, or pretty much any other custom post type.
One neat trick is to use the same password for multiple posts. If you do that, a user will only need to enter the password once to gain access to all the posts using that specific password.
How to password protect part of WordPress post
If you just want to add password protection to a specific bit of content inside an otherwise public WordPress post or page, you’ll need to turn back to third-party plugins for help. This time, you can use one called Content Protector:
As usual, install and activate the plugin to get started. You can configure some style and text options by going to Settings → Content Protector, but nothing is mandatory.
Unless you want to change something, you’re fine to just jump into protecting content. To do that, head to the WordPress Editor for the post you want to add password protected content to. Then, click on the new Add Content Protector shortcode button in your Editor:
Enter your password and click Insert:
Now, visitors will be able to see all of your normal content. But anything you put inside the shortcode will be password protected like this:
Wrapping things up
And that finishes up our guide to password protect WordPress in all kinds of ways. If you just need to restrict individual WordPress posts, you can use WordPress’ built-in password functionality. Otherwise, to password protect other parts of WordPress, you’ll need to use one of the third-party plugins I referenced above.
If you have any other questions about how to password protect WordPress, leave them in the comments and we’ll try to help out!