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.

Built from https://develop.svn.wordpress.org/trunk@34318


git-svn-id: http://core.svn.wordpress.org/trunk@34282 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2015-09-19 05:41:26 +00:00
parent 1b24c98739
commit 170a2cc4be
2 changed files with 12 additions and 1 deletions

View File

@ -1090,6 +1090,7 @@ function update_user_caches($user) {
* Clean all user caches * Clean all user caches
* *
* @since 3.0.0 * @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 * @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_login, 'userlogins' );
wp_cache_delete( $user->user_email, 'useremail' ); wp_cache_delete( $user->user_email, 'useremail' );
wp_cache_delete( $user->user_nicename, 'userslugs' ); 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 );
} }
/** /**

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.4-alpha-34317'; $wp_version = '4.4-alpha-34318';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.