Skip to content
Survey Result - Ext...
 
Notifications
Clear all

Survey Result - Extended Session Time

2 Posts
2 Users
0 Reactions
181 Views
(@webmaster)
Posts: 189
Reputable Member Admin
Topic starter
 

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

 
Posted : December 28, 2023 8:04 am
(@joe-norris)
Posts: 31
Eminent Member
 

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

 
Posted : December 29, 2023 11:02 am