How to Password Protect Posts and Pages in WordPress?

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.

Edit Visibility of WordPress Post
Edit Visibility of WordPress Post

You will see three options like below:

Password Protecting WordPress Post
Password Protecting WordPress Post
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.

Related:  How to Save Money with Bluehost Shared Hosting Registration?
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.

Password Prompt When Viewing the Post in Browser
Password Prompt When Viewing the Post in Browser

This is an ideal way to hide the content from public use and you can share the password only to premium members.

3. Private

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.

Private Post Display in WordPress
Private Post Display in WordPress

It is always a misunderstanding between password protection and private options. Below table shows the difference between these options:

FunctionPassword ProtectionPrivate
Search Engine IndexYes, URL will be indexed in search engines.No, WordPress will add noindex meta robots tag for private posts and pages.
Available for Post and PageYesYes
Public AccessPrompt you to enter password.Throw 404 page not found error.
Logged in AccessStill 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.

Related:  Analog Clock with HTML5 Canvas and JavaScript
Quick Edit to Password Protect
Quick Edit to Password Protect

Click on the “Quick Edit” to see and enter your password and update the post.

Entering Password for Protection
Entering Password for Protection

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 Protected Post
Password Protected Post

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.

The draft post and page will automatically be published when you set it as private.

Password protect and private functions can’t be used simultaneously. When you click on the private checkbox the password text box will be disabled.

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.

Protect Partial Content Using Shortcodes Ultimate Plugin
Protect Partial Content Using Shortcodes Ultimate Plugin

Recommended Articles:

Leave a Comment