How to Password Protect a WordPress Page or Post

Have you ever considered writing a blog article or page only for your family members or close friends? Or, Want to publish a specific page or blog article only for editors on your WordPress website? Well, In this article, we will teach you How to Password Protect a WordPress Page or Post.

WordPress comes with several fundamental content display options that most freshers ignore as a content publishing tool.

Consider protecting a WordPress site or blog as an example. While site owners might devote significant time and effort to implementing comprehensive security measures, this popular content management system (WordPress CMS) comes with built-in password protection to help protect websites from unauthorized access and modification.

In this article, we will teach you how you can create a password-protected page or blog post in WordPress. Also, we will look at the advantages and disadvantages of password procedures, as well as a simple framework for protecting WordPress pages and sites.

Why Should Pages in WordPress Be Password-Protected?

Password-protected pages or posts on your WordPress site enable you to keep specific parts of your website hidden from the public.

You could just want website editors or customers to view your login or registration page, or you might want to conceal elements of your site that are currently being built.

Password-protecting pages or posts in WordPress allow you to hide information from users unless they have a password, for whatever reason. This is great for sites that are only accessible to members or those that are targeted at a certain audience.

How to Password Protect a WordPress Page or Post?

If you are creating a WordPress website, you are probably always producing and reviewing new content to discover which pages provide the most traffic and SEO value.

As a consequence, it is important to protect these postings or pages so that unauthorized persons may not see, modify, or remove information until they are ready to publish blog articles or pages.

But how you can protect a post or a webpage with a password? WordPress, thankfully, makes it simple with a built-in tool that is fast and easy.

Follow these 6 easy steps to Password Protect a WordPress Page or Post

  1. Log in to your WordPress Admin Dashboard
  2. Select Posts, then All Posts from the drop-down menu. For page, select Pages then All Pages.
  3. Click on edit for a particular post or page.
  4. Modify the post/page visibility to Password Protected in the Publish option.
  5. After then enter a secured password.
  6. Click OK, and then finally publish your newly-protected post or page.

===== (In Details)=====

  1. Log in to your WordPress Admin Dashboard

If you do not log in as an administrator, you will not be able to modify the visibility or password of your posts or pages.

  1. Select Posts, then All Posts from the drop-down menu. For page, select pages then all pages.

If you want to protect a post, On your website admin dashboard and go to “Posts,” then “All Posts”. If you want to protect a page then go to “Pages” and then “All Pages”.

  1. Click on edit for a particular post or page.

Because password protection is applied per post, you will have to apply protection to each post or page as needed.

  1. Modify the post/page visibility to Password Protected in the Publish option.

Basically, WordPress posts or pages are set to Public by default, which means that anybody may see them. Only approved Admins and Editors have access to private sites, and Password Protected provides the maximum level of protection.

  1. After then enter a secured password.

Enter a highly secured password. The maximum password length is 20 characters, according to the official WordPress website.

  1. Click OK, and then finally publish your newly-protected post or page.

After making any changes you must need to published or update the post or page, click on the “Publish” button. For these already published posts or pages, you may need to click on the “Update” button.

How to Password Protect a WordPress website?

It is possible to password protect your whole WordPress website if you want even more security. If your website is not fully ready to publish yet or if your website is under development, this is an excellent option to password protect your website.

WordPress does not have this capability built-in, you will have to use plugin or HTTP authentication. Let us take a closer look at each one.

Password Protect a WordPress website Using Plugin

There are several free and paid WordPress plugins available for password-protecting your whole website While the specifics vary for every plugin, the essential concept is the same. Just choose a password for your website & any restrictions, such as users from specified IP addresses, then click apply on the save changes button. Visitors will see a WordPress login page when they visit your website, which needs a valid password to view your website content.

HTTP Authentication

This form of HTTP password security occurs on the web hosting/cPanel. Most web hosting companies now provide a one-click HTTP authentication feature for making a more secure website. Simply, choose a password for your website, as well as any type of restrictions, just like with plugin-based password security. Visitors will not able to see your website directly. They will see a WordPress logo when they will try to visit. And then they will get a text box field and ask them to log in to see the website content.

Hiding Password Protected Posts Completely from Home page and Archives page

All of your password-protected posts may display on your website’s home/blog page or archive page with the rest of your content. Use the bellow simple PHP code into your theme’s functions.php file or a website-specific plugin if you want to permanently hide them.

// Hide protected posts
function wpf_exclude_protected($where) {
    global $wpdb;
    return $where .= " AND {$wpdb->posts}.post_password = '' ";

// Where to display protected posts
function wpf_exclude_protected_action($query) {
    if( !is_single() && !is_page() && !is_admin() ) {
        add_filter( 'posts_where', 'wpf_exclude_protected' );

// Action to queue the filter at the right time
add_action('pre_get_posts', 'wpf_exclude_protected_action');

That is all there is to it. Your password-protected postings will not display on the front page or in the archives of the website. The password-protected post is only accessible by its specific URL. You can be able to send your post URL to your visitors with its password.

What happens in the search engine, when you password protect a post or page?

A WordPress page may be password-protected to prevent it from being seen by the general public. Most people will be unable to find it or access its content as a result of this.

Anyway, This technique does not restrict search engines from indexing the website and does not protect the posts/page’s information or content.

As a result, this approach should not be used for page material that must be kept secret at any cost.

The Advantages of Password Protection

Because they have a low barrier to access, passwords are still the most popular type of digital security. You will be permitted to enter if you know the password. And If you do not have that password, you will be denied from accessing the website.

They are also simple to integrate with the other security mechanisms to boost overall protection.

We hope this article helped you to password-protect pages and posts on WordPress Website.

If you like this article and want to support us, then please subscribe to our YouTube Channel (WpFresher – WordPress Tutorials) for many more WordPress video tutorials. You may also find us on Facebook & Twitter.

You May Also Read Our Recently Published Articles:

Our Small Request, Please, Subscribe to Us!

We will send you notifications for every new blog post. You can unsubscribe at any time.

One comment on “How to Password Protect a WordPress Page or Post

Leave a Reply