[Password Protect] one password for pages and posts using password protect

Is it possible that i set one password for all pages & posts which use password protect? If i change password, i no need to change all related posts and pages.

  • Nithin

    Hi kamhangmak,

    I'm afraid, that isn't possible out of the box with Password Protect plugin. The plugin is meant to be used to protect contents inside pages, or post via shortcodes, and the password is implemented within the shortcode side, for example:
    [protect password="newpassword"]

    And the only way would be to manually change the password, as that's how the default workflow of the plugin is, and it would require custom coding to implement such a workaround.

    I'll move this ticket to our Features & Feedback forums, so that such feature could be looked upon down the plugins roadmap.

    Regards,
    Nithin

  • Ash

    Hello kamhangmak

    Is it possible that i set one password for all pages & posts which use password protect?

    This is kinda possible with a bit of custom code. Please use the following:

    add_shortcode( 'wpmu_protect', function( $atts, $content = '' ) {
    	return do_shortcode( '[protect password="' . WPMU_PROTECT_PW . '"]' . $content . '[/protect]' );
    } );

    You can use this code in your child theme's functions.php if the theme is not changed. Otherwise mu-plugin is the best option. To create a mu-plugin, go to wp-content/mu-plugins folder. If there is no mu-plugins folder then, create one. Now, inside the mu-plugins folder create file with name anything.php (make sure file extension is .php). Now start with a <?php tag and then put the above code.

    And then add the following on wp-config.php file:

    define( 'WPMU_PROTECT_PW', 'qwert' );

    This is where you define the password instead of "qwert". This code should go before "That's all....." message in wp-config.php file.

    And then you can use it like the following:
    [wpmu_protect]Your password protected content goes here[/wpmu_protect]

    If i set one password for all posts and pages, whether users can surf all posts and pages without enter password again?

    Yes, right. The user won't need to enter password again.

    Hope it helps! Please feel free to ask more questions if you have any.

    Have a nice day!

    Cheers,
    Ash

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.