How to make the WordPress login cookie expire later than 2 weeks

By default, WordPress keeps you logged in for 14 days (if you flag the “Remember me” checkbox).

If you want to change this period to something different, you only have to add these lines to the functions.php of your theme:

add_filter( ‘auth_cookie_expiration’, ‘keep_me_logged_in_for_1_year’ );
function keep_me_logged_in_for_1_year( $expirein ) {
return 31556926; // 1 year in seconds
}

In this case, the cookie will expire in 1 year, so I don’t have to log in every two weeks. If you want the cookie a different period of time, just change that number accordingly (in seconds).

 

Speak Your Mind

*