admin管理员组文章数量:1315811
I wonder if there is any way to make email an optional field while registering using default form. So that those who don't know mail may leave it blank.
I got code from stackexchange but that doesn't seems to work.I added code to functions.php under theme folder.
add_action('user_profile_update_errors', 'my_user_profile_update_errors', 10, 3);
function my_user_profile_update_errors($errors, $update, $user) {
$errors->remove('empty_email');
}
add_action('user_new_form', 'my_user_new_form', 10, 1);
add_action('show_user_profile', 'my_user_new_form', 10, 1);
add_action('edit_user_profile', 'my_user_new_form', 10, 1);
function my_user_new_form($form_type) {
?>
<script type="text/javascript">
jQuery('#email').closest('tr').removeClass('form-required').find('.description').remove();
<?php if (isset($form_type) && $form_type === 'add-new-user') : ?>
jQuery ('#send_user_notification') .removeAttr('checked');
<?php endif; ?>
</script>
<?php
}
UPDATE
I mend to have optional mail registration on default registration page of wordpress (.php?action=register) not in dashboard.
Sorry for clarity in question .Won't repeat it again( am a newbie )
Any help is much appreciated. Thanks
Reference
本文标签: loginUpdatedhow to make email optional while user registration using default wordpress form
版权声明:本文标题:login - Updated : how to make email optional while user registration using default wordpress form 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741989215a2408869.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论