WordPress.org

Support

Support » How-To and Troubleshooting » Setting [Overriding] the Expiry for Password Protected Page

Setting [Overriding] the Expiry for Password Protected Page

  • amchidesign
    Member

    @amchidesign

    Hello all,

    I’ve got a password protected page that opens in a custom page template. It works perfectly, but once the password is entered successfully the cookie is stored for more then 24 hours. I’d like to change that. So my question is basically.

    How do I override the cookie setting for a specific password protected page so it expires after say 3 hours.

    Thank you for taking the time to look at this post and helping me out.

    Regards,

    Sid

Viewing 2 replies - 1 through 2 (of 2 total)
  • natyo12345
    Member

    @natyo12345

    if your using wordpress on your own website then you can edit the “wp-pass.php” file and where it says

    // 10 days
    setcookie(‘wp-postpass_’ . COOKIEHASH, $_POST[‘post_password’], time() + 864000, COOKIEPATH);

    Change the number after the plus sign to how many seconds until the cookie expires and you have to re-enter the password. if you wanted it for 3 hours you have to see how many seconds in an hour which is 3600 and times that by the amount of hours you need and so 3 hours would be 10800

    I hope this is what your looking for. i dont know what you would do if it was hosted on wordpress itself.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Setting [Overriding] the Expiry for Password Protected Page’ is closed to new replies.