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 have the following function in my functions.php. I am trying to disable the admin from receiving emails every time a new user joins the site. However, the admin is still receiving emails. Is there something wrong with the function? And is this part of the WP options by any chance? I couldn't find the option anywhere.

// Disable New User Reg Emails
if ( ! function_exists( 'wp_new_user_notification' ) ) :
    function wp_new_user_notification( $user_id, $plaintext_pass = '' ) {

        /** Return early if no password is set */
        if ( empty( $plaintext_pass ) )

        $user       = get_userdata( $user_id );
        $user_login = stripslashes( $user->user_login );
        $user_email = stripslashes( $user->user_email );

        // The blogname option is escaped with esc_html on the way into the database in sanitize_option
        // we want to reverse this for the plain text arena of emails.
        $blogname = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );

        $message  = sprintf( __( 'Username: %s' ), $user_login) . "\r\n";
        $message .= sprintf( __( 'Password: %s' ), $plaintext_pass) . "\r\n";
        $message .= wp_login_url() . "\r\n";

        wp_mail( $user_email, sprintf( __( '[%s] Your username and password' ), $blogname ), $message );

share|improve this question
up vote 0 down vote accepted

You need to implement your function earlier than you are. It seems that the "real" wp_new_user_notification() (from wp-includes/pluggable.php) is getting created before yours is. To test, remove the if ( ! function_exists( 'wp_new_user_notification' ) ) : from your code. You should be getting an error.

You could create a plugin:

//Plugin Name: blahblah
function wp_new_user_notification() {
  // your code

Alternatively, just put that code in it's own .php file and drop it in wp-content/mu-plugins directory (create if it doesn't exist). Problem should be solved.

share|improve this answer

There's a plugin that can handle disabling new user registrations: http://wordpress.org/extend/plugins/disable-new-user-notifications/

share|improve this answer
Hi Chip, that's actually the plugin where I got the function from. I just stripped the function because I didn't want to add another plugin. – Desi Jan 17 '13 at 21:55
And you're using it directly in your functions.php for the theme you're using? – NW Tech Jan 17 '13 at 22:08
Yes, that is correct. – Desi Jan 17 '13 at 22:10

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.