I am trying to figure out why new user registrations are receiving duplicate notification emails. They arrive at the exact same time but from different addresses, one is from the admin owner (myself) and the other one from wordpress@mysitedomain.org. I am using a custom registration form. Here are the relevant pieces of code:

// auto generate a password
$user_pass = wp_generate_password();

// setup new user
$userdata = array(
    'user_pass' => $user_pass,
    'user_login' => esc_attr( $_POST['user_name'] ),
    'user_email' => esc_attr( $_POST['email'] ),
    'first_name' => esc_attr( $_POST['firstname'] ),
    'last_name' => esc_attr( $_POST['lastname'] )

//insert it in db
$new_user = wp_insert_user( $userdata );

//send notification to user
wp_new_user_notification($new_user, $user_pass);

Any help would be appreciated.

  • Do any emails go out if you remove the wp_new_user_notification($new_user, $user_pass)? Also, do both emails contain the exact same content? May 9 '14 at 21:08
  • No, they won't go at all if I remove that, so both seem to be coming from that function. Exact same content, although the one with my admin name has everything all on one line instead of formatted with a line break.
    – amespower
    May 9 '14 at 21:31
  • What happens if you use the included registration form? Are you using a plugin for the form? Have you tried disabling all plugins? May 9 '14 at 21:51
  • Turns out it was indeed conflict with another plugin. I had done a search for wp_new_user_notification but none of my plugins were using it, however wp_mail was used. Removing that plugin fixed it. Thanks.
    – amespower
    May 15 '14 at 16:54

when you call the wp_new_user_notification()function an email is send to the user and to the admin.

other plugins or themes can create their own wp_new_user_notification() function. if that's the case then you need to check that function.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.