Connect with us

Password Security for a Page or Post in WordPress


Password Security for a Page or Post in WordPress

We guess you are in thought to create a WordPress post just for your close friends or family members. As a content publishing platform, WordPress have some basic content visibility options. Those options will helpful for you to create Password Security for a Post or Page in WordPress.

Here we clearly presented those details for you. Have a look at the article and learn how to create Password for a Post or Page in WordPress easily.

How to Create a Password for single Page or Post in WordPress

Creating Password Security for a WordPress Page or post is not a difficult task. If you want to create a password for your post or page then follow the given methods. Here we provided 2 different methods for you. By following one of these methods, you can easily create security for single post or page on your WordPress blog or site.

Create Password Security using Visibility Option

  • First, Login to your WordPress admin access.
  • Click on all posts option under posts section.
  • Select the post to which you want to create a password protection.
  • Click on edit from that post.
  • The selected post visual editor will appear on the screen.
  • At the right side of the Visual editor, you can see Publish section.
  • Click on edit from the visibility option under publish section.
  • Select Password Protected option.
  • Enter a new password.
  • Next, click on OK button.
  • Click on Publish button to save changes.
  • Now, share that password with your friends or family members then those are able to see that post.

In this way, you can simply create a password security for a post in your WordPress site. Follow the similar method to create password security for a page.

How to hide Password Protected Post from Homepage and Archives?

The Password protected WordPress post may appear on homepage or archives of your website. If you want to hide that password protected post completely, then follow the given step by step process.

  • Click on the Editor option from Appearance Section.
  • Next, click on Theme Functions (functions.php) file.
  • Now, the Theme Functions (functions.php) file appears on the screen.
  • Add the given code into Functions (functions.php) file.
1/ Hide password protected posts
2function exclude_protected($where) {
3    global $wpdb;
4    return $where .= " AND {$wpdb->posts}.post_password = '' ";
7// Where to show protected posts
8function exclude_protected_action($query) {
9    if( !is_single() && !is_page() && !is_admin() ) {
10        add_filter( 'posts_where', 'exclude_protected' );
11    }
14// Action to queue the filter at right time
15add_action('pre_get_posts', 'exclude_protected_action');
  • Next, click on update file button.
  • Now, the file is updated. Your password protected post will not appear on homepage or archives of your website.

In this simple way, you can hide Password Protected Post from Homepage and Archives. If you face any WordPress Theme Error while updating the file, then click here to get WordPress Theme Error Solutions.


Hope this article useful for you to create a password security for single WordPress Page or Post. If you get any error in your WordPress site then visit our site. Here we provided the best and quick ways for resolving your WordPress Errors. Stay connected with us for a better guidance on WordPress.

Continue Reading
Click to comment

Leave a Reply

Your email address will not be published. Required fields are marked *

More in solution

    About Me:

    Szabi Kisded

    Hey there, I'm Szabi. At 30 years old, I quit my IT job and started my own business and became a full time WordPress plugin developer, blogger and stay-at-home dad. Here I'm documenting my journey earning an online (semi)passive income. Read more

    Sign up for my newsletter and get the YouTube Caption Scraper WordPress plugin for free
    (worth 29$)!

    All My Plugins In A Bundle:

    My AutoBlogging Plugins:

    My Online Courses:

    A Theme I Recommend:

    Featured Posts:

    To Top