WordPress.org

Ready to get started?Download WordPress

Forums

Setting [Overriding] the Expiry for Password Protected Page (3 posts)

  1. amchidesign
    Member
    Posted 4 years ago #

    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

  2. natyo12345
    Member
    Posted 4 years ago #

    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.

  3. jijutm
    Member
    Posted 4 years ago #


Topic Closed

This topic has been closed to new replies.

About this Topic