Created
February 24, 2025 11:33
-
-
Save esedic/9be8de62bc6a75f5e144e8caab5c8895 to your computer and use it in GitHub Desktop.
Customizing WordPress User Registration Email
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function custom_registration_email($user_id) { | |
$user_info = get_userdata($user_id); | |
$to = $user_info->user_email; | |
$subject = 'Welcome to our site!'; | |
$message = 'Dear ' . $user_info->display_name . ',<br /><br />'; | |
$message .= 'Thank you for registering on our site. Here is your login information:<br />'; | |
$message .= 'Username: ' . $user_info->user_login . '<br />'; | |
$message .= 'Password: Your chosen password<br /><br />'; | |
$message .= 'If you have any questions, please contact us.<br /><br />'; | |
$message .= 'Best regards,<br />'; | |
$message .= 'The Site Team'; | |
$headers = array('Content-Type: text/html; charset=UTF-8'); | |
wp_mail($to, $subject, $message, $headers); | |
} | |
add_action('user_register', 'custom_registration_email'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment