WordPress sends a default “New User Registration” email when someone creates an account. On membership sites or custom registration flows, you often want to replace or augment this with a branded welcome email that includes the site URL, next steps, and styled HTML.
Problem: When a new user registers on a WordPress site, the default notification email is plain text, uses generic copy, and cannot be easily customised without editing core files.
Solution: Hook into user_register and send a custom email with wp_mail(). Enable HTML content via the wp_mail_content_type filter, build a template with the user's display name and site URL, and remove the default notification with remove_action if needed.
Hook into user_register to send a custom email after registration:
add_action( 'user_register', 'send_welcome_email', 10, 1 );
function send_welcome_email( $user_id ) {
$user = get_userdata( $user_id );
$to = $user->user_email;
$subject = sprintf( __( 'Welcome to %s!', 'textdomain' ), get_bloginfo( 'name' ) );
$body = '<html><body>';
$body .= '<h2>' . sprintf( __( 'Hi %s,', 'textdomain' ), esc_html( $user->display_name ) ) . '</h2>';
$body .= '<p>' . sprintf(
__( 'Welcome to <strong>%s</strong>! Your account is ready.', 'textdomain' ),
esc_html( get_bloginfo( 'name' ) )
) . '</p>';
$body .= '<p>' . __( 'Here's what you can do next:', 'textdomain' ) . '</p>';
$body .= '<ul>';
$body .= '<li><a href="' . esc_url( home_url( '/my-account/' ) ) . '">' . __( 'Visit your account', 'textdomain' ) . '</a></li>';
$body .= '<li><a href="' . esc_url( wp_login_url() ) . '">' . __( 'Log in', 'textdomain' ) . '</a></li>';
$body .= '</ul>';
$body .= '<p>' . __( 'Thanks for joining us!', 'textdomain' ) . '</p>';
$body .= '</body></html>';
$headers = [
'Content-Type: text/html; charset=UTF-8',
'From: ' . get_bloginfo( 'name' ) . ' <noreply@' . parse_url( home_url(), PHP_URL_HOST ) . '>',
];
wp_mail( $to, $subject, $body, $headers );
}
// Optionally suppress the default WordPress new-user email
add_filter( 'wp_send_new_user_notification_to_user', '__return_false' );
To also suppress the admin notification email (useful when users self-register frequently):
add_filter( 'wp_send_new_user_notification_to_admin', '__return_false' );
NOTE: The wp_send_new_user_notification_to_user and wp_send_new_user_notification_to_admin filters were added in WordPress 4.6. On earlier installations, use remove_action( 'register_new_user', 'wp_send_new_user_notifications' ) instead.