Make WordPress Core


Ignore:
Timestamp:
12/06/2022 01:52:02 PM (20 months ago)
Author:
spacedmonkey
Message:

Users: Clear the user_meta cache when clean_user_cache function is called.

Unlike other clean cache functions like clean_post_cache, clean_user_cache did not also clear user meta caches. This is inconsistent and can result in some strange side effects. Update the clean_user_cache function to also clear user meta caches when called.

Props dd32, spacedmonkey, peterwilsoncc.
Fixes #54316.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/user.php

    r54891 r54940  
    18741874 * @since 3.0.0
    18751875 * @since 4.4.0 'clean_user_cache' action was added.
     1876 * @since 6.2.0 User metadata caches are now cleared.
    18761877 *
    18771878 * @param WP_User|int $user User object or ID to be cleaned from the cache
     
    18931894        wp_cache_delete( $user->user_email, 'useremail' );
    18941895    }
     1896
     1897    wp_cache_delete( $user->ID, 'user_meta' );
    18951898
    18961899    /**
Note: See TracChangeset for help on using the changeset viewer.