check email exist or not wordpress 1

check email exist or not wordpress

$email = 'myemail@example.com';
$exists = email_exists( $email );
if ( $exists ) {
    echo "That E-mail is registered to user number " . $exists;
} else {
    echo "That E-mail doesn't belong to any registered users on this site";
}

Here is what the above code is Doing:
1. We’re using the email_exists() function to check if the email address exists in the database.
2. If the email address exists, we’re displaying a message that says the email address is registered to a user.
3. If the email address doesn’t exist, we’re displaying a message that says the email address doesn’t belong to any registered users.

Similar Posts