0

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.

0

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 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. – Lucien Dubois Feb 5 at 23:38
  • I have created a plugin and it is same. It seems that it doesn't hook the function. – gdfgdfg Feb 6 at 0:06
  • Even if I comment //add_action(register..., it still sends the default email. – gdfgdfg Feb 6 at 0:12

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.