只是copy the above code and paste it into your theme’s functions.php file. 在这里,我将向您展示will reject registration from all others email addresses 和Only allowing some email addresses to create an account. 请参见下面的代码
function is_valid_emails($login, $email, $errors ){
$valid_emails = array("[email protected]");
$valid = false;
foreach( $valid_emails as $valid_email ){
$valid_emails_list = strtolower($valid_email);
$current_email = strtolower($email);
if( $current_email == $valid_emails_list ){
$valid = true;
break;
}
}
if( $valid === false ){
$errors->add(\'domain_whitelist_error\',__( "<strong>ERROR</strong>: you can\'t register email because only allow some specific email addresses" ));
}
}
add_action(\'register_post\', \'is_valid_emails\',10,3 );
你可以
add more email addresses 通过在代码中添加更多内容:
$valid_emails = array("[email protected]","[email protected]");