Last updated on

Sometimes you don’t want your entire WordPress website shown to all users. Luckily WordPress can password protect pages or posts using Core functionality. If you want users to register or hide from the public for privacy reasons, this can be a great solution.

To enable the WordPress password protected page feature, please follow these instructions:

  • Open the page or post you want to protect
  • In the Publish metabox there is a Visibility option
  • Choose Password protected in the dropdown
  • Enter the password you wish your users to enter to access the content
  • Click the blue Publish to save your changes

WordPress Password Protected Page Settings

Each page and post can have a unique password, or they can all be the same. With this method each user cannot have their own password. If you want unique passwords per user, you will need to have your users register. You can also use a plugin, which we will discuss later in this article.

Customize the Password Protected Page in WordPress

Next you may want to change the password protected message that displays. By default the message reads:

This content is password protected. To view it please enter your password below:

To change this message, you can use a plugin like WordPress Password Protect Page. It lets you edit the form in the WordPress Customizer and provides other useful options.

If you are selling memberships or access to your content, you’ll need a plugin like Paid Memberships Pro. It is widely used and provides a lot more tools to promote your paid content.

Those looking for a customizable PHP implementation can use custom code. In your child theme, or using a plugin like Code Snippets, you can modify the password form with a filter.

Here’s the code you can customize:

function my_custom_password_form() {
		global $post;
		$label = 'pwbox-' . ( empty( $post->ID ) ? rand() : $post->ID );
		$output = '
		<div class="boldgrid-section">
			<div class="container">
				<form action="' . esc_url( site_url( 'wp-login.php?action=postpass', 'login_post' ) ) . '" class="form-inline post-password-form" method="post">
					<p>' . __( 'This content is password protected. This is a custom message. To view it please enter your password below:' ) . '</p>
					<label for="' . $label . '">' . __( 'Password:' ) . ' <input name="post_password" id="' . $label . '" type="password" size="20" class="form-control" /></label><button type="submit" name="Submit" class="button-primary">' . esc_attr_x( 'Enter', 'post password form' ) . '</button>
	return $output;
add_filter('the_password_form', 'my_custom_password_form', 99);

We hope this helps you better work with password protected pages in WordPress. Please let us know your thoughts in the comments below.




   200+ Design Templates + 1 Kick-ass SuperTheme
   6 WordPress Plugins + 2 Essential Services

Everything you need to build and manage WordPress websites in one Central place.

8 thoughts on “Edit the WordPress Password Protected Page

    • Hi Marjan,

      Am I correct to say that, you are looking a plugin to add-on with Password Protect Page that would allow you to “force change” or override password options in the case that you were locked out of the page? Is this correct?

  1. Hi! I tried to add the WordPress Password Protect Page plugin as you suggest, and the snippet with the Code Snippets plugin too, but it doesn’t work, I tried to add just a word before “Ciao! This content…” and it doesn’t appear, it seams the WordPress Password Protect Page plugin have more priority than the snippet.
    Could you help me?

      • Yes! I see the page with the form for the password, I can stylize it with the “Personalise” directly on the page, but the script doesn’t work, everything I do on the script doesn’t affect the content on the page…

        Please see

        • Thanks Sasha, I’m sorry to hear you’re still experiencing this issue. If you could start a new Support Forum thread and include that screenshot and a link to your website we can take a deeper look into the problem and try to provide you with a sure solution.

Leave a Reply

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