I want to disable the default email that is send when user is registered. I am using this plugin for email verification User Verification By PickPlugins, which sends an email with confirmation link, but the problem is that by default and WordPress send an email via pluggable.php:

function wp_new_user_notification( $user_id, $deprecated = null, $notify = '' ){...}

I am using a theme (which I am extending with a child theme), which calls wp_create_user. I have replaced that parent theme function and in my functions.php I have added:

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

add_action(    'register_new_user',   'wpse236122_send_new_user_notifications' );

function wpse236122_send_new_user_notifications(  $user_id, $notify = 'user' ){
    wp_send_new_user_notifications( $user_id, $notify  );

The problem is, it still send both emails, from the plugin and default WordPress email for new user registration. I don't know how to disable this email.


Considering your code to be working, simply put it in a plugin. It should then work!

  • Why doesn't work in functions.php for the active theme, but will work in a plugin ?
    – gdfgdfg
    Feb 5 '19 at 23:12
  • Long story short, it's related to the order of which plugins and theme load. Some hooks needs to fire before others. Feb 5 '19 at 23:38
  • I have created a plugin and it is same. It seems that it doesn't hook the function.
    – gdfgdfg
    Feb 6 '19 at 0:06
  • Even if I comment //add_action(register..., it still sends the default email.
    – gdfgdfg
    Feb 6 '19 at 0:12

Move the parameter default into the function.

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

add_action(    'register_new_user',   'wpse236122_send_new_user_notifications' );

function wpse236122_send_new_user_notifications(  $user_id ){
    wp_new_user_notification( $user_id, null, 'user' );

Changed the wpse236122_send_new_user_notifications function to use the wp_new_user_notification as opposed to the action directly. Even though it works, it is more likely to break in a WordPress update.

I would also mention maybe instead of removing the action on init, use the register_new_user action and set at a lower priority. WordPress core uses 10 by default, so putting yours at 9 or below will work.

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

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.