Survey Result - Extended Session Time

One of the comments in the survey was about how often people are logged out and have to re-login, even after clicking the "Remember Me" checkbox. I have also found it annoying, although it is made easier if you use the built-in browser password manager so it automatically fills in your password (different topic).
So I started researching and discovered that the website software (WordPress) has a default session time of a few hours, but you can extend that to 2 days by clicking the 'remember me' checkbox. That's all! Two days! Kind of a PITA. So I found some code and copied it into the application. Just a couple of lines of code and it fixes the problem!
add_filter( 'auth_cookie_expiration', 'extend_login_session' );
function extend_login_session( $expire )
{ return 31556926; // seconds for 1 year time period }
Now you should have noticed that you are not being logged out as often. (This also depends on your browser and if your environment changes). A positive change from the survey (hat tip to Joe!).
Jerry
Jerry
I fly (and ride) to free my mind from the tyranny of petty things. Antoine de Saint-Exupéry

Jerry,
Thanks so much for tracking this down. I haven't been logged off since we exchanged emails, so i think it's working. Good on ya, man!!
Joe
Ride on!!
Joe
- 29 Forums
- 11.7 K Topics
- 90.4 K Posts
- 1 Online
- 5,503 Members