My HP

19th April, 2020 | Getting Started |

How to Password Protect posts and pages in WordPress

It can sometimes be useful to hide the content of a WordPress page, or post from general visitors, but still allow it to be accessible to those you want to provide access to.

WordPress allows you to quickly set this up using the Password Protect visibility option. You can set this when adding a new page / post, or you can edit an existing page / post to change it to be password protected.

In this guide we will show you how to password protect both an existing page and an existing post. We will start with password protecting one of our WordPress pages.

If alternatively you are looking to only password protect a post, you can skip straight to the How to password protect a post section of this guide.


How to password protect a page:

Firstly you will need to log in your WordPress admin area / dashboard - This will normally be at a URL such as mydomain.com/wp-admin  (replacing mydomain.com with your own domain name)

Once logged in, hover over Pages on the left menu, then click on the All Pages option.

As mentioned we will be password protecting an existing page in this guide - In this case our "Demo Page".

Hover over the page you would like to edit, then click the Edit option.

Note: If you want to add a new page and password protect it at the same time, you can still follow this guide, just go to Pages - Add New from the left hand menu of your WordPress dashboard, then continue with the next step of this guide.

Once you are in the page editor, within the Publish box on the right hand side of the page - click on the Edit button next to: Visibility: Public


This will then open up the page visibility options.

Select the Password Protected option, and enter a password that you would like to use for visitors to access the page.  In this example we've set the password as: demopass

Once you've set this, click on the Update button to update your page. This will then set the page visibility to Password Protected.


Once you've updated the page, if you go back to Pages - All Pages on the left hand menu of your WordPress dashboard, you will then spot that your page states "Password Protected" to the right of the page name.

This confirms that the page is now Password Protected.


Next it is always worth visiting the page on your website - either when logged out of WordPress, or in a separate browser / private browsing window.

When visiting the page as a normal website visitor you should then see a password protected prompt, like in the example below.

Enter the password you have set in to the Password: box, then click on Enter  (In this example our password was set to: demopass)


If the password was entered correctly, your WordPress site will then display the page content as normal

For our example - this is simply just a "Congratulations" message we've set to confirm that we can see the page.

Note: Once you've entered the password to view the page, you will still see the content if refreshing the page - this is due to how the site stores cookies. If you need to re-test, either use a new private browsing window or clear your web browser cache / history.

How to password protect a post:

Firstly, if you are not already logged in to your WordPress site, you will need to log in your WordPress admin area / dashboard - This will normally be at a URL such as mydomain.com/wp-admin  (replacing mydomain.com with your own domain name)

Once logged in, hover over Posts on the left menu, then click on the All Posts option.

As mentioned we will be password protecting an existing post in this section of the guide - In this case our "Demo Post".

Hover over the Post you would like to edit, then click the Edit option.

Note: If you want to add a new post and password protect it at the same time, you can still follow this guide, just go to Posts - Add New from the left hand menu of your WordPress dashboard, then continue with the next step of this guide.

Once you are in the post editor, within the Publish box on the right hand side of the page - click on the Edit button next to: Visibility: Public


This will then open up the post visibility options.

Select the Password Protected option, and enter a password that you would like to use for visitors to access the post.  In this example we've set the password as: demopass

Once you've set this, click on the Update button to update your post. This will then set the post visibility to Password Protected.


Once you've updated the post, if you go back to Posts - All Posts on the left hand menu of your WordPress dashboard, you will then spot that your post states "Password Protected" to the right of the post name.

This confirms that the post is now Password Protected.


Next it is always worth visiting the post on your website - either when logged out of WordPress, or in a separate browser / private browsing window.

When visiting the post as a normal website visitor you should then see a password protected prompt, like in the example below.

Note: in this example we've simply visited our homepage, as the recent posts are set to show on the homepage when using the default WordPress theme.

Enter the password you have set in to the Password: box, then click on Enter  (In this example our password was set to: demopass)


If the password was entered correctly, your WordPress site will then display the post content as normal

For our example - this is simply just a "Congratulations" message we've set to confirm that we can see the post content after visiting the homepage and entering the password.

Note: Once you've entered the password to view your post, you will still see the content if refreshing the page / post - this is due to how the site stores cookies. If you need to re-test, either use a new private browsing window or clear your web browser cache / history.

Removing Password Protection:

If you ever need to remove the password protection from a page or post on your WordPress site, simply follow the above steps to edit your page or post, but change the Visibility option to: Public

Then click on the Update button.

When visiting the page or post, this should now no longer require a password to access, and display the content normally.

Comments