WordPress is a powerful content management tool and offers most of the basic features as built-in package. It is not necessary to share all content on your site with all users publicly. Sometimes you may need to protect the content from public use and offer it only to specific group of users. For example, when you are running a membership site premium members may have access to content protected with password. WordPress by default allows to protect posts and pages with password and we will see how to do that in this article.
Password Protect Posts and Pages in WordPress
WordPress allows users to create two type of content – posts and pages. The default password protection option is available for both posts and pages. You can set password to individual post and page in two ways – inside editor and using quick edit option.
Password Protecting Posts
Setting Password on the Editor
The “Publish” meta box will appear on the righthand sidebar of the WordPress visual editor. By default the visibility of the post is set as public and click on the “Edit” link option against the visibility.
You will see three options like below:
1. Public and sticky post
This is the default option and you can make the post sticky on the front page. The sticky option will be available only for the posts and pages will not have this option.
2. Password Protected
This is the way to protect your WordPress posts with password. Choose this option and enter your password to protect the post. When you or someone trying to access the page, it will prompt to enter the password.
This is an ideal way to hide the content from public use and you can share the password only to premium members.
If you want to make the post not available to anyone then choose it as a private. Only logged admin or author can view the private posts. Private posts are not indexed by search engines as WordPress will set noindex meta robots tag and throw 404 page not found error when someone tries to access the URL. There will also be a “Private” label in front of the title when a logged in admin or post author view the URL.
It is always a misunderstanding between password protection and private options. Below table shows the difference between these options:
|Search Engine Index||Yes, URL will be indexed in search engines.||No, WordPress will add noindex meta robots tag for private posts and pages.|
|Available for Post and Page||Yes||Yes|
|Public Access||Prompt you to enter password.||Throw 404 page not found error.|
|Logged in Access||Still prompt for the password for first time.||Display the post / page with the "Private" label in front of the title.|
Setting Password Using Quick Edit Option
Password protect option on the editor is useful for the new posts but for the already posts you can easily set password protection without opening the post in editor. Navigate to “Posts > All Posts” and hover over the post you want to set the password.
Click on the “Quick Edit” to see and enter your password and update the post.
Now that the post will be showing as “Password Protected” and prompt for the password when someone tries to access it on the browser.
Password Protection for Pages
Similar to posts you can password protect the pages on the editor as well as using quick edit option. The only difference is that, you need to navigate to “Pages > All Pages” and hove over the required page to see the “Quick Edit” option.
Using Plugins for Password Protection
There are plenty of plugins available offering password protection functionality for your WordPress site. The default password protect feature may not help you in cases where you want to show the partial content to registered users. You can use plugins like shortcodes ultimate to insert shortcodes wherever on the post or page to protect remaining part of the content. You will see message like below prompting to login or register.