When a user registers on your WordPress site or you create a user manually in wp-admin an email is sent automatically. In many cases this email will not be adequate; you may want to add a link, customize some of the copy, or create an HTML email with images.

The solution is to change the WordPress default implementation of the wp_new_user_notification() function. wp_new_user_notification() is a pluggable function which means you’ll need to create a plugin in order to redefine it.

Get Started, Create a Plugin

The first step in modifying the email is to create our plugin. Simply create a directory in wp-content/plugins/ called user-emails, then create a file within the directory called user-emails.php. Open user-emails and add this to the top:

Your plugin should be working and you should be able to go to the wp-admin plugins menu and activate it.

Define wp_new_user_notification()

The next step is to update wp_new_user_notification() to make a few changes. The original function is defined in wp-includes/pluggable.php. Start by defining the function like this:

now when users register nothing will happen since we defined the function to do nothing. Using the original function as a reference we can create something similar, but with a twist; we’ll create an html email to send to the user along with a logo for the site.

The first step is to filter wp_mail_content_type to return text/html; this allows us to send html emails. Then we get the user object using the id, this way we can get user meta such as their first name or email address. We set some other variables as well such as the website url and the url for the site’s logo. Next we send the admin email, leave this step out if you like. After the admin email is sent we include the email_welcome.php file; this will be the html email template that we will send. After sending the email the final step is to remove the wp_mail_content_type filter so emails get sent out using the default type.

Next Steps

First add the sitelogo.gif file to the wp-content/plugins/user-emails directory. Next create a new file in the wp-content/plugins/user-emails directory called email_welcome.php. This file is the template for the email that will be sent out and can be totally custom, whatever you want for your site. This example should get you started:

That should be it, now when a user is created on your site the email sent will contain the new HTML markup, including the site logo that was added.

9 comments on “Change the WordPress User Registration Welcome Email

  1. Norm says:

    This is great! Thanks so much for sharing. Only one issue though, when a new user gets an email, the username being sent is the user ID, which is not helpful to them, they want the user login name. What needs to be changed in user-emails.php to do this? Thanks!

  2. Niels says:


    I was using your code for a while and it was working great!

    But it isn’t working anymore.. do you have any idea how that is possible? WordPress updates maybe!?


  3. Kit Johnson says:

    Just wanted to say a huge thank you. I’ve been trying to accomplish this for a very long time. All the other plugins / tutorials didn’t work for me. But yours did : )

    I was wondering if it was possible to completely remove the default email that new users get. (Currently following your tutorial the new user receives the default email plus this nice new customised one.) If we were going to achieve that we would need to put user password into the customised email. I didn’t have any success with that using $user->user_pass — all I got was a hashed value.

    Anyway, thanks again!

  4. David Wampamba says:

    To send with the user name and password.

    User variables like $user->user-login and $plaintext_pass in your email_welcome.php file.

    Otherwise thanks Joe

  5. tikkral says:

    very helpful, but i use arabic as a language is there a way around that?

  6. Parminder Kaur says:

    I just want to send different emails to different users according to different role like customer, vendor , officiator etc for woo commerce site how it possible.

    1. elvis says:

      you can try doing consitionals per role like this:
      if($user->roles[0] == ‘vendor’){
      // do something

  7. Anneke says:

    This a great plugin! I only don’t get the $plaintext_pass to work. No matter what I try, $user->user_pass, $user->user_password, the password doesn’t show in the email. What am I doing wrong?

  8. Saman Shahzadi says:

    This is not working in latest version of WordPress, please guide

Comments are closed.