确定给定的电子邮件是否存在。
原型
email_exists( string $email )
描述
有关此功能和类似主题功能的更多信息,请查看Theme Developer Handbook中的Conditional Tags文章。
参数
$email
(string)
(Required)
电子邮件。
返回值
(int|false)
成功时用户的ID,失败时为false。
源文件
路径:wp-includes/user.php
<?php
...
function email_exists( $email ) {
if ( $user = get_user_by( 'email', $email) ) {
return $user->ID;
}
return false;
}
...
?>
其他
英文文档:https://developer.wordpress.org/reference/functions/email_exists/