Support » Fixing WordPress » How to set password protected page to expire after 10 mins

  • Hi

    How can I set my password protected page in WP 3.5.1 to expire after 10 minutes or so? I did some research and found that there used to be an easy way to do this using wp-pass.php but this file got retired after WP 3.4
    I’m not finding how this functionality was replaced.

    The issue is that if users access protected pages on public computers, that anyone can access that page until the cookie expires (if that’s how it works, I suspect it does). I haven’t even been able to find what the current default expiration time is in WP 3.5.1

    Any pointers much appreciated!

Viewing 1 replies (of 1 total)
  • Hi,

    you can edit wp-login.php file on line where is

    setcookie( 'wp-postpass_' . COOKIEHASH, $hasher->HashPassword( stripslashes( $_POST['post_password'] ) ), time() + 10 * DAY_IN_SECONDS, COOKIEPATH );

    Change “10 * DAY_IN_SECONDS” to how many seconds until the cookie expires and you have to re-enter the password. If you wanted it for 10 minutes you have to change for 600.

    You can change for “time() + 10 * DAY_IN_SECONDS” to 0. Then the password will be required after each browser is closed.

Viewing 1 replies (of 1 total)
  • The topic ‘How to set password protected page to expire after 10 mins’ is closed to new replies.