0
我使用这个插件创建在WordPress http://www.wpexplorer.com/wordpress-user-contact-fields/使自定义用户注册领域需要
定制注册字段我想作所需的所有自定义字段。我想下面的代码,但它不工作 - 注册即使在自定义字段为空完成:
function myplugin_registration_errors($errors, $sanitized_user_login, $user_email) {
if (empty($_POST[$field[0]]) || ! empty($_POST[$field[0]]) && trim($_POST[$field[0]] ) == '') {
$errors->add('first_name_error', __('<strong>ERROR</strong>: You must include a first name.', 'mydomain'));
}
return $errors;
}
我把它从http://codex.wordpress.org/Customizing_the_Registration_Form抄本页面和闭幕后直插入它foreach($ extra_fields as $ field)构造。
任何想法,我可以使它的工作?
天才!我忘了添加'add_filter'钩子(尽管只需要第二个过滤器)。此外,我将$ _POST [$ field [0]]更改为$ _POST ['facebook'],并最终开始工作。 – Anna 2014-10-20 21:45:04