Un motore di ricerca WordPress per sviluppatori e autori di temi



get_user_by ›

Da2.8.0
Deprecaton/a
get_user_by ( $field, $value )
Parametri: (2)
  • (string) $field The field to retrieve the user with. id | ID | slug | email | login.
    Richiesto:
  • (int|string) $value A value for $field. A user ID, slug, email address, or login name.
    Richiesto:
Ritorna:
  • (WP_User|false) WP_User object on success, false on failure.
Definito a:
Codex:
ChangeLog:
  • 4.4.0

Retrieve user info by a given field



Sorgenti

function get_user_by( $field, $value ) {
		$userdata = WP_User::get_data_by( $field, $value );

		if ( ! $userdata ) {
			return false;
		}

		$user = new WP_User;
		$user->init( $userdata );

		return $user;
	}
endif;

if ( ! function_exists( 'cache_users' ) ) :