正在查看 4 个帖子:1-4 (共 4 个帖子)
-
作者帖子
-
我在网上找的代码可以隐藏邮箱输入框,但不能取消没填写邮箱的错误,怎么隐藏这个错误?
提前感谢回复
你可以尝试使用下面的代码,简单讲就是 JS 实现注册无需邮件地址验证。
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 }
是放到 functions.php 里吗?我看上去和之前一样啊
看上去是一样,只是不用输入邮箱就可以注册成功,添加位置没错。
-
作者帖子
正在查看 4 个帖子:1-4 (共 4 个帖子)
- 哎呀,回复话题必需登录。