0

My client wants to turn off the email you receive when register.

  • 1
    If you disable registration notifications for users, how will they activate accounts? How will they get the password? – nmr Apr 8 at 19:41
  • Yeah it's weird the client wants to send it manually but I've manage to find a way with a plugin. – Mark Anthony Apr 9 at 15:21
3

The function that generates the new user notification is wp_new_user_notification(). It is called by another (similarly named) function wp_new_user_notifications() which is triggered by the action hook register_new_user in the register_new_user() function.

If you follow that (or even if you don't), all you need to do is remove the wp_new_user_notifications() filter from the register_new_user action:

add_action( 'init', function() {
    remove_action( 'register_new_user', 'wp_send_new_user_notifications' );
});

As others have noted, if you remove this, then depending on how you have the site set up with user passwords, etc, you may have to consider how users will be able to initially access the site.

1

You can declare a new replacement wp_new_user_notification that does not send notifications in a plugin. It's a pluggable function, meaning that the WordPress core version is only used if a plugin hasn't defined a version already.

You'll find the current core version in wp-includes/pluggable.php. If you still want the admin notification email then copy everything up to $key = wp_generate_password( 20, false ); into your replacement.

Beware that this is now a fairly poor experience for new users: they'll have to sign up and then use your login form to reset their password. Unless you have some other mechanism for setting and sending them credentials.

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.