If the page is password protected then set the timeout for the cookie to
60 minutes.
add_action('wp_enqueue_scripts', 'glm_site_scripts');
+add_action( 'wp', 'post_pw_sess_expire' );
+function post_pw_sess_expire() {
+ global $post;
+ if ( post_password_required() ) {
+ 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, $_COOKIE['wp-postpass_' . COOKIEHASH], strtotime( '+60 minutes' ), COOKIEPATH);
+ }
+ }
+}
?>
Author: Gaslight Media
Author URI: http://www.gaslightmedia.com
Description: A theme for Adeline Construction
-Version: 1.0.3
+Version: 1.0.4
*/