Created
May 19, 2023 19:15
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://developer.wordpress.org/reference/hooks/auth_cookie_expiration/