WordPress cookies always expire at the end of the session instead

Despite the fact that I set the cookie expiration date using the auth_cookie_expiration filter in functions.php, none of my login cookies have expiration dates – looking in Chrome the cookies expire at the end of the session. This is true for the wordpress_logged_in and wordpress_sec cookie.

In functions.php, I have the code below. I have also tried a simpler version of the code below. I tried deactivating plugins that are related to logins, and I even grepped auth_cookie_expiration to identify plugins that may be overriding it. De-activating plugins seems to have no effect. I am on a multi-site network, and none of the site cookies have expiration dates.

I don’t think it’s the code below, because I also tried a much simpler version of the code. What could be causing the issue?

Thank you.

add_filter(‘auth_cookie_expiration’, ‘my_expiration_filter’, 99, 3);

function my_expiration_filter($seconds, $user_id, $remember){

//if “remember me” is checked;

if ( $remember ) {

//WP defaults to 2 weeks;

$expiration = 14*24*60*60; //UPDATE HERE;

} else {

//WP defaults to 48 hrs/2 days;

$expiration = 2*24*60*60; //UPDATE HERE;



if ( PHP_INT_MAX – time() < $expiration ) {

//Fix to a little bit earlier!

$expiration = PHP_INT_MAX – time() – 5;


return $expiration;