Skip to content

Commit

Permalink
Set WP_Session expiration variant to 23 hours. This could potentially…
Browse files Browse the repository at this point in the history
… save a ton of DB writes. #2031
  • Loading branch information
pippinsplugins committed May 18, 2014
1 parent e0e3c1b commit ec36b88
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions includes/class-edd-session.php
Expand Up @@ -80,6 +80,7 @@ public function __construct() {
require_once EDD_PLUGIN_DIR . 'includes/libraries/wp-session.php';
}

add_filter( 'wp_session_expiration_variant', array( $this, 'set_expiration_variant_time' ), 99999 );
add_filter( 'wp_session_expiration', array( $this, 'set_expiration_time' ), 99999 );

}
Expand Down Expand Up @@ -189,6 +190,18 @@ public function set_cart_cookie( $set = true ) {
}
}

/**
* Force the cookie expiration variant time to 23 hours
*
* @access public
* @since 2.0
* @param int $exp Default expiration (1 hour)
* @return int
*/
public function set_expiration_variant_time( $exp ) {
return current_time( 'timestamp' ) + ( 30 * 60 * 23 );
}

/**
* Force the cookie expiration time to 24 hours
*
Expand Down

0 comments on commit ec36b88

Please sign in to comment.