Recently one of our users asked if there was a way to disable lost/changed password email notifications in WordPress? By default, WordPress automatically sends email notification to admins when any other user resets their password using the lost password link. These emails can become annoying if you are running a site with many users. In this article, we will show you how to disable lost/changed password email notifications in WordPress.
First thing you need to do is create a site-specific WordPress plugin. A site specific WordPress plugin allows you to add any custom code to change or extend the functionality of WordPress on your site. We have detailed instructions on why and how to create a site-specific WordPress plugin.
Once you have created your site specific WordPress plugin, then you need to add these two lines to your plugin.
if ( !function_exists( 'wp_password_change_notification' ) ) { function wp_password_change_notification() {} }
Save your changes and then activate your site-specific plugin.
That’s all. WordPress will stop sending you email notifications whenever a user changes their password.
Let us explain the code to you. WordPress has a built-in function wp_password_change_notification
located in /wp-includes/pluggable.php
file. That function is responsible for sending those email notifications when a user resets their password.
These two lines of code override the built-in function and instead of sending an email, it instructs WordPress to do nothing.
You might be wondering why not paste this code in your theme’s functions.php file?
Because it won’t work. WordPress loads pluggable.php file before your theme’s functions.php file, so you cannot override the functions defined in pluggable.php in your theme’s functions.php file. That’s why you need to paste this code in a site-specific plugin.
We hope this article helped you disable password change email notifications on your multi-user WordPress site. You may also want to take a look at how to disable new user email notifications, or how to turn off comment notifications in WordPress.
If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Google+.
Ali Jooyafar says
Thank You So much because of your useful tutorial.
a WP User From Iran. <3
WPBeginner Support says
Glad our guide was helpful
Admin
David says
Hello Good day wpbeginners, I tried using code snippet plugin, then placing the codes but I get an error saying
“The snippet has been deactivated due to an error on line 3: Cannot redeclare function wp_password_change_notification”.
Please I need a solution to this. Thanks
WPBeginner Support says
For the method in this article, you would need to add it as a custom plugin and not using an additional plugin for it to work.
Admin
Marc says
Thank you so much, so many emails and thus energy wasted nowadays, that could be saved with 3 lines of code.. thank you!!
WPBeginner Support says
Glad our guide was helpful, while not the solution for every site we’re glad this could be something useful to you
Admin
Christopher Simmons says
Thanks for this, was resetting some of my author passwords simply for security, and they started complaining why they were getting emails about it when they no longer write for my publication — doh. This would have helped there, and now it’s in place in our “extension plugin” we put all our hacks into.
THANK YOU!
ronald says
Thanks for this code it helps me and my admin.
Marie Jac says
Hi!
I am trying to remove the notification sent to the user himself when reset his password (because an email is already sent by another customer plugin). The code above seems to only remove notification to admin. Is there another code I can use?
Thank you!!
Guido says
There is an hook for that.
Simply add this line of code
remove_action( 'after_password_reset', 'wp_password_change_notification' );
Fábio Tojal says
Hi there,
I am having problem! When I click on Reset Password nothing Happens! It stays in the same page!
Do you know what is happenig ?
Thanks!
Steve Barman says
The plugin generated 4 characters of unexpected output during activation. If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin. – I hope this isn’t anything to worry about
WPBeginner Support says
If you continue to see this message, then please inform the plugin author.
Admin
John Dough says
Another option is to filter all emails from change password to the trash. In GMail you can setup a filter by opening the email and then somewhere along the top is a list of options. One is filter messages like these. Follow the onscreen instructions and send them to the trash.
Bajza Ferenc says
Hi,
I found better solution for solve this problem without plugin.
Backup your wp-includes/pluggable.php
Edit wp-includes/pluggable.php file
Find wp_password_change_notification part
Delete these lines from file:
if ( !function_exists(‘wp_password_change_notification’) ) :
/**
* Notify the blog admin of a user changing password, normally via email.
*
* @since 2.7.0
*
* @param object $user User Object
*/
function wp_password_change_notification(&$user) {
// send a copy of password change notification to the admin
// but check to see if it’s the admin whose password we’re changing, and skip this
if ( 0 !== strcasecmp( $user->user_email, get_option( ‘admin_email’ ) ) ) {
$message = sprintf(__(‘Password Lost and Changed for user: %s’), $user->user_login) . “\r\n”;
// 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);
wp_mail(get_option(‘admin_email’), sprintf(__(‘[%s] Password Lost/Changed’), $blogname), $message);
}
}
endif;
Save.
Enjoy.
WPBeginner Support says
We strongly advise our users, to NEVER edit core WordPress files.
Admin
Alvaro says
NEVER, NEVER, NEVER edit WordPress core files.
Any change should be done through a plugin or a child theme.
Pam Blizzard says
Exactly what I wanted to know – and I thought putting a snippet in functions.php was the best way to go, but I’m so glad you mentioned that it wouldn’t work. THANK YOU!