🚀 Is building a website too difficult? Let me guide you step by step—Learn about the 「Naibabiji WordPress Website Building Coaching Service」 →

WordPress Remove Mandatory Email Field for New User Registration (Email Optional for Registration)

Websites built with WordPress support user registration for e-commerce sites. By default, registration requires users to fill in an email address, which is mandatory. However, some websites have special circumstances and may not need to enforce email entry. Therefore, we can use the following code to change the mandatory email field to an optional item. The specific method is as follows: Recently, when working with clientsForeign Trade Website Building, I have become accustomed to usingCode Snippetsthis plugin to manage custom code, so this tutorial also uses this method. 1. InstallCode Snippets2. Create a new Code, copy the code below, and save it.WordPress移除用户新注册时邮件必填选项
// 移除空邮件地址的提示
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');
}

// 这将删除电子邮件输入所需的javascript验证
// 还将删除标签中的(必填)提示
// https://blog.naibabiji.com/skill/users-without-email-in-wordpress.html
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) {
?>

3. After saving, the email field will no longer be mandatory when users register on the frontend or when adding users in the backend.WordPress移除用户新注册时邮件必填选项

🚀 Still feeling confused after reading the tutorial? Let me guide you step-by-step instead.

「Naibabiji WordPress Website Building Coaching」 — From selecting a domain and purchasing hosting to installing themes and publishing posts, I「ll guide you through every step, helping you avoid detours and reach your goals directly.

👉 Learn about Website Building Coaching Service
🔒

Comments are closed

The comment function for this article is closed. If you have any questions, please feel free to contact us through other channels.

×
二维码

Scan to Follow