随着互联网发展,现在很多网站都不用将邮箱作为必填项,更多的会使用手机号可以注册登录,所以电子邮箱可以放在用户中心作为选填项目,以免影响用户体验,那么如何在WordPress注册页面去掉邮箱验证?
这个需求比较特殊,但是我还是花时间测试并修正了下面的代码:
//WordPress组织免邮箱注册功能实现
add_action(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’register_form\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’,\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’cwp_remove_remail_on_registration_screen\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’);
function cwp_remove_remail_on_registration_screen(){
?>
<style>
/*隐藏电邮输入栏*/
#registerform>p:first-child+p{display:none;}
/*隐藏这句话:\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\”密码将通过电子邮件发送给您。\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\”*/
#reg_passmail{display:none;}
</style>
<script type=\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\”text/javascript\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\” src=\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\”https://www.wpzt.net/<?php echo site_url(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’/wp-includes/js/jquery/jquery.js\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’);?>\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\”></script>
<script type=\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\”text/javascript\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\”>
/*为隐藏的邮件输入栏根据用户输入的用户名和当前的域名自动输入邮箱*/
jQuery(function(){
jQuery(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’#user_login\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’).change(function(){
jQuery(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’#user_email\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’).val(jQuery(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’#user_login\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’).val()+\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’@\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’+window.location.host);
})
});
</script>
<?php
}