From 09e3149b7a7e03de363e1070af66d78d2d570a39 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Sat, 19 Sep 2015 05:40:22 +0000 Subject: [PATCH] Add a `'clean_user_cache'` action at the end of `clean_user_cache()`. This is mighty similar to `clean_post_cache()`. Props elliott-stocks, wonderboymusic. Fixes #31918. git-svn-id: https://develop.svn.wordpress.org/trunk@34318 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/user-functions.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/wp-includes/user-functions.php b/src/wp-includes/user-functions.php index 8015d1c3c1..856ca673c8 100644 --- a/src/wp-includes/user-functions.php +++ b/src/wp-includes/user-functions.php @@ -1090,6 +1090,7 @@ function update_user_caches($user) { * Clean all user caches * * @since 3.0.0 + * @since 4.4.0 'clean_user_cache' action was added. * * @param WP_User|int $user User object or ID to be cleaned from the cache */ @@ -1104,6 +1105,16 @@ function clean_user_cache( $user ) { wp_cache_delete( $user->user_login, 'userlogins' ); wp_cache_delete( $user->user_email, 'useremail' ); wp_cache_delete( $user->user_nicename, 'userslugs' ); + + /** + * Fires immediately after the given user's cache is cleaned. + * + * @since 4.4.0 + * + * @param int $user_id User ID. + * @param WP_User $user User object. + */ + do_action( 'clean_user_cache', $user->ID, $user ); } /**