Digital strategist, front end + email developer, WordPress enthusiast, IT tinkerer, and not-so-horrible writer

How to Stay Logged in to WordPress For X Number of Days

If you're like me you've tired logging in to each WordPress site you manage every 2 days (or two weeks if you check off the Remember Me checkbox before clicking Log In) and want a way to extend the the log in period. Enter the following function:

/** Extend logged-in time period from the default to 30 days **/
function keepLoggedInFor30Days( $expirein ) {
return 2592000; // 30 days in seconds
add_filter( 'auth_cookie_expiration', 'keepLoggedInFor30Days' );

Pop that code into your theme's function's file and you're set for 2592000 seconds AKA 30 days. Easy peasy.

Leave a reply