Created
May 26, 2020 16:54
-
-
Save someguy9/f403b1a685230c756056915e7e922822 to your computer and use it in GitHub Desktop.
Gets the user ID by email in WordPress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Get user ID by email | |
$user_data = get_user_by('email', 'your@email.com'); | |
$user_id = $user_data->ID; | |
$user_email = $user_data->user_email; | |
if(!empty($user_id)){ | |
echo 'The user ID for '.$user_email.' is '.$user_id; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment