After a certain amount of time WP logs out all users and forces them to log back in again. For development environments on my local machine this is obnoxious and absolutely unnecessary.
Is there an API-driven way of disabling the auto-logout indefinitely? Ideally I’d like something I can add to wp-config.php
along with other dev-setup-related settings.
A plugin would be overkill for me so I won’t consider it an answer, but you might as well post it as an option.
By default, the “Remember Me” checkbox makes you get remembered for 14 days. This is filterable though.
This code will change that value:
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
}