我想知道这个代码有什么问题:
if ( !empty( $_POST[\'email\'] ) ){
if (!is_email(esc_attr( $_POST[\'email\'] )))
$error[] = __(\'The Email you entered is not valid. please try again.\', \'profile\');
elseif(email_exists(esc_attr( $_POST[\'email\'] )) != $current_user->ID )
$error[] = __(\'This email is already used by another user. try a different one.\', \'profile\');
else{
wp_update_user( array (\'ID\' => $current_user->ID, \'user_email\' => esc_attr( $_POST[\'email\'] )));
}
}
这对我不起作用,我尝试了几次修改,但都没有成功。它不断警告我“此电子邮件已被其他用户使用。”但事实并非如此!好像这段代码验证得不好。PS:我从这里得到了这个代码:How to edit a user profile on the front end?