L
L
Lici2015-06-19 22:26:08
CMS
Lici, 2015-06-19 22:26:08

How to disable "new user" SPAM from WordPress?

A new user has been registered on your website "Your Advisor":
Username: Ololoev
E-mail: [email protected]

This is constantly hammering from all sites on WordPress, but it’s not a filter to create in the mail from this very informative message. Where is it disabled in the admin panel? I can not find.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
ankfrv, 2015-06-20
@ankfrv

It doesn't turn off in the admin. Either install the plugin or edit /wp-includes/pluggable.php
Search in the file for the query:
function wp_new_user_notification

I
Igor Vorotnev, 2015-08-01
@HeadOnFire

As I wrote ankfrv in a comment, pluggable functions are those that you can override. Therefore, the solution is simple - copy the original wp_new_user_notification() function from the pluggable.php file to your functions.php and remove the code that sends letters to the admin. The output will be like this:

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 ) ) {
      return;
    }
      
    $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 );
  }
endif;

There is a Disable New User Notification Emails plugin that does exactly the same thing.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question