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

*

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close