• The default duration for cookies set with wp-pass is 10 days. I want to be able to set it to just one day. How do I go about doing this? Of course, I can hack wp-pass and it’ll work just fine, but I’d like to have a more long-term solution (one that will last through updates).

    I can’t see a hook or action that’ll do this, and it’s not in pluggable.php… Is there a solution?

    Thanks in advance.

Viewing 1 replies (of 1 total)
  • This could be a solution that should last through updates:

    1. Copy your own wp-pass.php into your template directory.
    2. Change default password form so that it will now link to wp-pass.php in your template directory. How? You have to define your own function in template functions.php based on get_the_password_form() from post-template.php and use add_filter('the_password_form', 'my_custom_password_form');
    3. In your wp-pass.php change the cookie expiration duration and fix the link to wp-load.php.

    My wp-pass.php looks like this and it works just fine.

    /** Make sure that the WordPress bootstrap has run before continuing. */
    require( dirname(__FILE__) . '/../../../wp-load.php');
    
    if ( get_magic_quotes_gpc() )
    	$_POST['post_password'] = stripslashes($_POST['post_password']);
    
    // Expires when the browser shuts down
    setcookie('wp-postpass_' . COOKIEHASH, $_POST['post_password'], 0, COOKIEPATH);
    
    wp_safe_redirect(wp_get_referer());
Viewing 1 replies (of 1 total)
  • The topic ‘Change wp-postpass expiration duration’ is closed to new replies.