How To Extend Auto Logout Period In WordPress

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

Just add following snippet to your current theme’s functions.php file:

The above code will keep you the cookies for a year. You can change the time period by changing return value in above code with your preferred time (in seconds).