Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I get an email notifying me of every new user registration on my site and now that it gets hundreds or thousands of new users a day, it's getting a little out of hand.

It seems like it'd be a Wordpress setting to disable it, but I can't seem to find anything. Do I really need a plugin to do this?

share|improve this question
    
No plugins are necessary. This is a wordpress.com article, but it applies to all newer versions of wordpress. en.support.wordpress.com/enable-disable-comments –  Stephen Sep 15 '12 at 11:07
add comment

2 Answers 2

up vote 1 down vote accepted

One plugin, among several: http://wordpress.org/extend/plugins/disable-new-user-email-notifications/

You can grab the function out of it and use it directy in functions.php

share|improve this answer
add comment

There are several ways to prevent user notification for new registered users and user password changes.

One would be to change the pluggable functions "wp_new_user_notification" and "wp_password_change_notification". A different way would be to post the following code in functions.php.

It uses the "phpmailer_init" hook to test, if the subject of the mail is the one sent by "wp_new_user_notification" and "wp_password_change_notification". If the condition is met then the $phpmailer object is newly initialized. That means it is empty and cannot be sent since phpmailer class checks if there is at least a single recipient.

// prevent admin notification email for new registered users or user password changes
function conditional_mail_stop() {
    global $phpmailer;
    $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
    $subject = array(
        sprintf(__('[%s] New User Registration'), $blogname),
        sprintf(__('[%s] Password Lost/Changed'), $blogname)
    );
    if ( in_array( $phpmailer->Subject, $subject ) )
        // empty $phpmailer class -> email cannot be send
        $phpmailer = new PHPMailer( true );
}
add_action( 'phpmailer_init', 'conditional_mail_stop' );
share|improve this answer
    
It is best to post some explanation along with your code, as well as links to more information-- especially to the Codex. The automated system will flag answers with nothing but code as poor quality. –  s_ha_dum Oct 7 '13 at 22:57
    
Thank you, I explained the code a bit. –  KeineKaefer Oct 11 '13 at 19:49
add comment

Your Answer

 
discard

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.