A WordPress-centric search engine for devs and theme authors



get_userdata ›

Since0.71
Deprecatedn/a
get_userdata ( $user_id )
Parameters:
  • (int) $user_id User ID
    Required: Yes
Returns:
  • (WP_User|bool) WP_User object on success, false on failure.
Defined at:
Codex:

Retrieve user info by user ID.



Source

function get_userdata( $user_id ) {
		return get_user_by( 'id', $user_id );
	}
endif;

if ( ! function_exists( 'get_user_by' ) ) :
	/**
	 * Retrieve user info by a given field
	 *
	 * @since 2.8.0
	 * @since 4.4.0 Added 'ID' as an alias of 'id' for the `$field` parameter.
	 *
	 * @param string     $field The field to retrieve the user with. id | ID | slug | email | login.
	 * @param int|string $value A value for $field. A user ID, slug, email address, or login name.
	 * @return WP_User|false WP_User object on success, false on failure.
	 */