update_user_caches() – Updates all user caches.

You appear to be a bot. Output may be restricted

Description

Updates all user caches.

Usage

$void|false = update_user_caches( $user );

Parameters

$user
( object|WP_User ) required – User object or database row to be cached

Returns

void|false Void on success, false on failure.

Source

File name: wordpress/wp-includes/user.php


Lines:

1 to 18 of 18
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_nicename, $user->ID, 'userslugs' );

  if ( ! empty( $user->user_email ) ) {
    wp_cache_add( $user->user_email, $user->ID, 'useremail' );
  }
}
 

 View on GitHub View on Trac