Duplicate notifications for new user registration

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 [email protected]. 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.

Topic email user-registration Wordpress

Category Web


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

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.