Password Protect plugin- when does the password expire?

Is there a time limit on how long it caches the password once you have typed it in? I have it on a site but am wondering if there is a control somewhere where I can have it log them out after 15 minutes of inactivity so that they have to enter it again to access the content.

  • Michael Bissett

    Hey @spark4, hope you're doing well today! :slight_smile:

    The plugin itself has a cookie time of 10 days (you can see this if you look at line 93 of protect-selected-content/protect-selected-content.php), but as for something like what you're wanting, that isn't possible presently, though I will say that it's an interesting idea.

    I've moved this over to the Features and Feedback section, so that this can be voted on by the others here in the community for inclusion in a future release.

    I should note though, that as we're presently focusing on new releases, it's going to take a fair amount of votes for this to be considered.

    By the way, thanks for being a member here at WPMU DEV, glad to have you in the community! :slight_smile:


  • Ash

    Hello @spark4

    I hope you are well today.

    Yes, you are right.

    To change the cookie time you need to edit that line:
    setcookie( 'psc-postpass_' . COOKIEHASH, sha1( $_POST['post_password'] ), time() + 864000, COOKIEPATH );

    Change 864000 to anything in seconds. So if you want 15 mins, then you need to use 900 in there.

    Please note that, this changes will be lost in next update. So it's worth to note down this changes somewhere and apply again after your updates.

    Hope it helps :slight_smile: Please feel free to ask more question if you have.


Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.