WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using this function in functions.php to auto log in users after the sign up in the front-end

function auto_login_new_user( $user_id ) {
add_action( 'user_register', 'auto_login_new_user' );

This works great for auto login in users but for some reason this also causes the automatic confirmation email not being sent to users anymore. I have no idea why though, any suggestions would be really helpful.


share|improve this question
up vote 1 down vote accepted

You're short-circuiting the registration process when you redirect and exit script execution, the user_register action isn't the last step of the process. You can try to call wp_new_user_notification manually, but I'm not sure what other side-effects that may have.

share|improve this answer
Thanks a lot for the tip. I added this line before the exit command. This sends an email to admin but it doesn't send an email to the registered user, is there a way to get the email to the user as well? – user2028856 Jun 14 '14 at 8:58
Okay I get it to work by removing the exit command from the function, but I'm getting the admin email twice for some reason for each user – user2028856 Jun 14 '14 at 11:16

may be the wp_redirect causing the problem. you must call wp_new_user_notification before the redirect.

May be a problem here - see the note on wordpress codex and the example in the codex

<?php wp_new_user_notification( $user_id, $plaintext_pass ) ?>

Note: If password is not passed to function, the newly registered user will not receive their welcome email.

share|improve this answer

Your Answer


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.