Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/get user id from string

This function has been deprecated. That means it has been replaced by a new function or is no longer supported, and may be removed from future versions. All code that uses this function should be converted to use its replacement if one exists. See also wp-includes/deprecated.php. Use get_user_by instead.


Get a numeric user ID from either an email address or a login. If a number is sent to the function, that number is returned as the id.


<?php get_user_id_from_string$string ); ?>


(string) (required) String representation of the user to lookup the ID for. May be either the user's login (their username), or the email address registered in WordPress. A numeric string is considered to be an existing user ID and is simply returned as such.
Default: None

Return Values

ID of the user specified by $string on success, null if no user is found.

Source File

get_user_id_from_string() is located in wp-includes/ms-functions.php

Change Log

  • Since @WPMU
  • Deprecated 3.6.0