Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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.

share|improve this question
    
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? –  czerspalace May 9 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. –  bklynM May 9 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? –  czerspalace May 9 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. –  bklynM May 15 at 16:54

1 Answer 1

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.

Regards

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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