diff --git a/wp-includes/ms-functions.php b/wp-includes/ms-functions.php index a277e8fa2d..5e594b0e07 100644 --- a/wp-includes/ms-functions.php +++ b/wp-includes/ms-functions.php @@ -206,9 +206,12 @@ function add_user_to_blog( $blog_id, $user_id, $role ) { * @param int $blog_id Blog ID. */ do_action( 'add_user_to_blog', $user_id, $role, $blog_id ); - wp_cache_delete( $user_id, 'users' ); + + clean_user_cache( $user_id ); wp_cache_delete( $blog_id . '_user_count', 'blog-details' ); + restore_current_blog(); + return true; } diff --git a/wp-includes/pluggable.php b/wp-includes/pluggable.php index ceaacdad41..4edb9929f6 100644 --- a/wp-includes/pluggable.php +++ b/wp-includes/pluggable.php @@ -2506,7 +2506,7 @@ if ( ! function_exists( 'wp_set_password' ) ) : array( 'ID' => $user_id ) ); - wp_cache_delete( $user_id, 'users' ); + clean_user_cache( $user_id ); } endif; diff --git a/wp-includes/user.php b/wp-includes/user.php index 9e95a88cac..dd4d3f82f7 100644 --- a/wp-includes/user.php +++ b/wp-includes/user.php @@ -1853,8 +1853,8 @@ function wp_insert_user( $userdata ) { } elseif ( ! $update ) { $user->set_role( get_option( 'default_role' ) ); } - wp_cache_delete( $user_id, 'users' ); - wp_cache_delete( $user_login, 'userlogins' ); + + clean_user_cache( $user_id ); if ( $update ) { /** @@ -1980,8 +1980,7 @@ function wp_update_user( $userdata ) { $send_email_change_email = apply_filters( 'send_email_change_email', true, $user, $userdata ); } - wp_cache_delete( $user['user_email'], 'useremail' ); - wp_cache_delete( $user['user_nicename'], 'userslugs' ); + clean_user_cache( $user_obj ); // Merge old and new fields with new fields overwriting old ones. $userdata = array_merge( $user, $userdata ); diff --git a/wp-includes/version.php b/wp-includes/version.php index 7d2599c359..4475302e33 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.3-alpha-45714'; +$wp_version = '5.3-alpha-45715'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.