Skip to content

Instantly share code, notes, and snippets.

Last active June 9, 2022 10:22
What would you like to do?
Send custom email content for new WooCommerce Users-Users Import export
add_filter('wt_user_registration_email', 'wt_user_registration_email');
function wt_user_registration_email($mail_attrs)
$user = get_user_by('id', $mail_attrs['user_id']);
$first_name = $user->first_name;
$blog_name = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
$user_login = $user->user_login;
$password = $mail_attrs['password'];
$subject = 'Your account has been created!';//please change mail subject
$mail_body = "Hi ".$first_name.",
Thanks for creating an account on ".$blog_name." . Your username is ".$user_login." . You can access your account area to view orders, change your password.
Your password has been generated: ".$password."
We look forward to seeing you soon.
".$blog_name;//please change mail body
$mail_attrs['subject'] = $subject;
$mail_attrs['body'] = nl2br($mail_body);
return $mail_attrs;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment