diff --git a/wp-includes/user.php b/wp-includes/user.php index 6222e932a9..635f82c5ed 100644 --- a/wp-includes/user.php +++ b/wp-includes/user.php @@ -2780,8 +2780,6 @@ All at ###SITENAME### $current_user = wp_get_current_user(); if ( $current_user->ID === $user_id ) { if ( isset( $plaintext_pass ) ) { - wp_clear_auth_cookie(); - /* * Here we calculate the expiration length of the current auth cookie and compare it to the default expiration. * If it's greater than this, then we know the user checked 'Remember Me' when they logged in. @@ -2790,13 +2788,20 @@ All at ###SITENAME### /** This filter is documented in wp-includes/pluggable.php */ $default_cookie_life = apply_filters( 'auth_cookie_expiration', ( 2 * DAY_IN_SECONDS ), $user_id, false ); + wp_clear_auth_cookie(); + $remember = false; + $token = ''; + + if ( false !== $logged_in_cookie ) { + $token = $logged_in_cookie['token']; + } if ( false !== $logged_in_cookie && ( (int) $logged_in_cookie['expiration'] - time() ) > $default_cookie_life ) { $remember = true; } - wp_set_auth_cookie( $user_id, $remember ); + wp_set_auth_cookie( $user_id, $remember, '', $token ); } } diff --git a/wp-includes/version.php b/wp-includes/version.php index 3c3d557def..cc8c7e7dd5 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.8-alpha-59632'; +$wp_version = '6.8-alpha-59633'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.