wpseek.com
A WordPress-centric search engine for devs and theme authors



get_userdata › WordPress Function

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

Retrieves 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' ) ) :
	/**
	 * Retrieves 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.
	 *
	 * @global WP_User $current_user The current user object which holds the user data.
	 *
	 * @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.
	 */