From: Steve Sutton Date: Thu, 24 Aug 2017 12:41:11 +0000 (-0400) Subject: Setting time limit for the password pages. X-Git-Tag: v1.0.4^2 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/index.cgi?a=commitdiff_plain;h=77ed4d9e5658336374dcb8d3bc15198e8652a06c;p=WP-Themes%2FAdelaineConstruction.git Setting time limit for the password pages. If the page is password protected then set the timeout for the cookie to 60 minutes. --- diff --git a/functions.php b/functions.php index b159b2b..6eaf7e7 100644 --- a/functions.php +++ b/functions.php @@ -169,4 +169,14 @@ function glm_get_header() { 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); + } + } +} ?> diff --git a/style.css b/style.css index cf1a3ca..77ede02 100644 --- a/style.css +++ b/style.css @@ -3,5 +3,5 @@ Theme Name: Adeline-Construction Author: Gaslight Media Author URI: http://www.gaslightmedia.com Description: A theme for Adeline Construction -Version: 1.0.3 +Version: 1.0.4 */