HTTP/2 301
server: nginx
date: Sun, 28 Dec 2025 20:54:45 GMT
content-type: text/html; charset=UTF-8
location: https://developer.wordpress.org/reference/functions/get_user_id_from_string/
x-content-type-options: nosniff
content-language: en
x-ua-compatible: IE=Edge
vary: Accept-Encoding, Cookie
expires: Thu, 01 Jan 1970 00:00:00 GMT
cache-control: no-cache, no-store, max-age=0, must-revalidate
pragma: no-cache
alt-svc: h3=":443"; ma=86400
strict-transport-security: max-age=31536000
HTTP/2 200
server: nginx
date: Sun, 28 Dec 2025 20:54:47 GMT
content-type: text/html; charset=UTF-8
vary: Accept-Encoding
x-olaf: ⛄
vary: accept, content-type
link:
; rel="https://api.w.org/"
link:
; rel="alternate"; title="JSON"; type="application/json"
link: ; rel=shortlink
x-frame-options: SAMEORIGIN
content-encoding: gzip
alt-svc: h3=":443"; ma=86400
x-nc: MISS ord 2
get_user_id_from_string() – Function | Developer.WordPress.org
get_user_id_from_string( string $email_or_login ): int
Get a numeric user ID from either an email address or a login.
A numeric string is considered to be an existing user ID and is simply returned as such.
$email_or_loginstringrequiredEither an email address or a login.
function get_user_id_from_string( $email_or_login ) {
_deprecated_function( __FUNCTION__, '3.6.0', 'get_user_by()' );
if ( is_email( $email_or_login ) )
$user = get_user_by( 'email', $email_or_login );
elseif ( is_numeric( $email_or_login ) )
return $email_or_login;
else
$user = get_user_by( 'login', $email_or_login );
if ( $user )
return $user->ID;
return 0;
}
View all references View on Trac View on GitHub
User Contributed Notes
You must log in before being able to contribute a note or feedback.