k-isabelle
5/31/2018 - 4:29 PM

WordPress - Password Protected Pages - Force Password Entry

WordPress - Password Protected Pages - Force Password Entry

//------------------------------------------------------------
//  Password Protected Pages - Force Immediate Cookie Expiry
//------------------------------------------------------------

add_action( 'wp', 'post_pw_sess_expire' );
    function post_pw_sess_expire() {
    if ( isset( $_COOKIE['wp-postpass_' . COOKIEHASH] ) )
    // Setting a time of 0 in setcookie() forces the cookie to expire with the session
    setcookie('wp-postpass_' . COOKIEHASH, '', 0, COOKIEPATH);
}