Codex tools: Log in / create account
Contents |
Returns the user ID of the user specified by either username or registered email address.
<?php get_user_id_from_string( 'user@example.com' ); ?>
<?php
$useremail = 'user@example.com';
$userid = get_user_id_from_string( $useremail );
if ($userid !== null) {
echo 'User '.$useremail.' has the user ID of '.$userid;
} else {
echo 'User '.$useremail.' not found.';
}
?>