WordPress.org

Ready to get started?Download WordPress

Forums

How to set password protected page to expire after 10 mins (2 posts)

  1. kubegusa
    Member
    Posted 1 year ago #

    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!

  2. madmacho
    Member
    Posted 10 months ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic