Password Protect Cookie Saved for Longer than 10 days

I read that the password is saved for 10 days in an encrypted cookie. How do I set it for longer or even infinite?


  • Patrick

    Hi there @dgoudy

    Welcome to the forums, glad to have you aboard!

    You can't set a cookie to an indefinite period (not that I know of anyway).

    But you can change it to a ridiculously high value if you like. :slight_smile:.

    In the main plugin file - protect-selected-content.php - scroll down to where you see this line:
    setcookie( 'psc-postpass_' . COOKIEHASH, sha1( $_POST['post_password'] ), time() + 864000, COOKIEPATH );

    Change time() = 864000 to this to set the cookie for a whole year:
    time() + 60*60*24*365

    If you want it to last longer, simply adjust the 365 to however many days you want.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.