Setting A Custom Session Timeout
//****************************************************************
//****************************************************************
//********** OVERRIDE WORDPRESS DEFAULT SESSION TIMEOUT **********
//****************************************************************
//****************************************************************
add_filter('auth_cookie_expiration', 'my_expiration_filter', 99, 3);
function my_expiration_filter($seconds, $user_id, $remember)
{
//Set expiration to 48 hrs
//$expiration = 2*24*60*60;
//Set expiration to 2 weeks
$expiration = 14*24*60*60;
//http://en.wikipedia.org/wiki/Year_2038_problem
if ( PHP_INT_MAX - time() < $expiration )
$expiration = PHP_INT_MAX - time() - 5; //Fix to a little bit earlier
return $expiration;
}
Feel free to comment if you can add help to this page or point out issues and solutions you have found. I do not provide support on this site, if you need help with a problem head over to stack overflow.