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 firstname.lastname@example.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.