WordPress 用户管理 完全移除email邮箱 代码实例

WordPress一般情况下用户的邮箱Email字段为必填项。我们记录一下在用户注册管理中,如何将email字段去除。

在functions.php中添加如下代码( 如何方便的在更新主题时保留 functions.php 里的自定义 ):

// This will suppress empty email errors when submitting the user form 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'); }  // This will remove javascript required validation for email input // It will also remove the '(required)' text in the label // Works for new user, user profile and edit user forms 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();         // Uncheck send new user email option by default         <?php if (isset($form_type) && $form_type === 'add-new-user') : ?>             jQuery('#send_user_notification').removeAttr('checked');         <?php endif; ?>     </script>     <?php }  remove_filter( 'authenticate', 'wp_authenticate_email_password', 20 );

腾讯云限时秒杀【点击购买】

搬瓦工,CN2高速线路,1GB带宽,电信联通优化KVM,延迟低,速度快,建站稳定,搬瓦工BandwagonHost VPS优惠码BWH26FXH3HIQ,支持<支付宝> 【点击购买】!

Vultr$3.5日本节点,512M内存/500G流量/1G带宽,电信联通优化,延迟低,速度快【点击购买】!

阿里云香港、新加坡VPS/1核/1G/25G SSD/1T流量/30M带宽/年付¥288【点击购买】

WordPress 用户管理 完全移除email邮箱 代码实例

`微信`扫码 加好友

链接到文章: https://www.gkxyz.com/wordpress-yonghuguanli-wanquanyichuemailyouxiang-daimashili.html

推荐站点

  • 腾讯云 – 产业智变 云启未来

    腾讯云为数百万的企业和开发者提供安全稳定的云计算服务,涵盖云服务器、云数据库、云存储、视频与CDN、域名注册等 […]

  • Akamai(Linode)

    Deploy more with Linux virtual machines, global infrast […]

  • RAKsmart

    主机商介绍:RAKsmart是知名的美国服务器租用商,包括美国站群服务器、美国cn2服务器、香港服务器等热门产 […]

  • 阿里云-为了无法计算的价值

    阿里云——阿里巴巴集团旗下公司,是全球领先的云计算及人工智能科技公司之一。提供免费试用、云服务器、云数据库、云 […]

评论已关闭