Uses
| Uses | Description |
|---|---|
| wp-includes/cache.php: wp_cache_add() | Adds data to the cache, if the cache key doesn’t already exist. |
Update all user caches
(WP_User) (Required) User object to be cached
(bool|null) Returns false on failure.
File: wp-includes/user.php
function update_user_caches( $user ) {
if ( $user instanceof WP_User ) {
if ( ! $user->exists() ) {
return false;
}
$user = $user->data;
}
wp_cache_add( $user->ID, $user, 'users' );
wp_cache_add( $user->user_login, $user->ID, 'userlogins' );
wp_cache_add( $user->user_email, $user->ID, 'useremail' );
wp_cache_add( $user->user_nicename, $user->ID, 'userslugs' );
} | Version | Description |
|---|---|
| 3.0.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/update_user_caches