Skip to content

Instantly share code, notes, and snippets.

@lukecav
Created May 19, 2023 19:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lukecav/d4c17518bf384bd1476120365db537b6 to your computer and use it in GitHub Desktop.
Save lukecav/d4c17518bf384bd1476120365db537b6 to your computer and use it in GitHub Desktop.
Stay logged in to wp-admin (WordPress Dashboard) for 48 hours in WordPress
function extend_auth_cookie_expiration( $expiration, $user_id, $remember ) {
// Set the desired cookie expiration time (48 hours in this example)
$cookie_expire = 2 * DAY_IN_SECONDS;
// Return the new expiration time
return $cookie_expire;
}
add_filter( 'auth_cookie_expiration', 'extend_auth_cookie_expiration', 10, 3 );
@lukecav
Copy link
Author

lukecav commented May 19, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment