WordPress Auto Logout

When you click on the “Remember Me” option on the login page of your WordPress website, it will keep you logged in for 2 weeks. If you don’t, it will keep your login active for 2 days. However, you can extend the auto logout period in WordPress by adding a little code snippet. Keep in mind that it will affect site’s security by keeping user logged in for too long.

function keep_me_logged_in_for_1_year($expirein) {
return 31536000; // one year in seconds
}
add_filter( 'auth_cookie_expiration', 'keep_me_logged_in_for_1_year' );

The above code will keep your authentication cookie for a year.

Have a nice day!