I have made a series of posts and pages password protected on my website using the built-in Visibility setting. They all use the same password, so the user can view all of them after entering the password once.
The problem: I need the session to time out after an hour. I have tried using this code in my functions.php file.
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);
}
It successfully clears the cache, but I would like to extend the time rather than expiring the session immediately. Any help would be greatly appreciated!