13

I want to disable the emailnotification if a user or an admin changes the password of a user.

After some Googleling I came to find that I need to create a plugin and overwrite the wp_password_change_notification function found in pluggable.php.

This is the plugin and function:

<?php
/*
Plugin Name: Stop email change password
Description: Whatever
*/

if ( !function_exists( 'wp_password_change_notification' ) ) {
    function wp_password_change_notification() {}
}
?>

I uploaded the file to my plugin folder and activated it in my admin panel!

This needs to be done with a plugin because the pluggable.php file is loaded before the functions.php file.

Anyway it doesn't seem to work for me.......

The user still receives the email.

I diabled all plugins and run the plugin on a clean install so no interference

The WP_DEBUG doesn't show any errors as well!!!

Can anybody tell me what to change or how to fix it any other way (except core modifications :-))

M.

  • 1
    I also struggled and tried creating/using a custom plugin, setting the WordPress-filters to false but nothing worked... Just today I stumbled upon the Manage Notification E-mails plugin and it works :) – Leander Feb 26 '16 at 9:40
16

To disable user email notification, add this in a plugin or theme:

add_filter( 'send_password_change_email', '__return_false' );

FYI wp_password_change_notification() controls admin email notification when a user changes their password

7

To disable Admin email notification when a user resets their own password, create a Plugin (or Must Use Plugin) using the following code snippet:

/**
 * Disable Admin Notification of User Password Change
 *
 * @see pluggable.php
 */
if ( ! function_exists( 'wp_password_change_notification' ) ) {
    function wp_password_change_notification( $user ) {
        return;
    }
}

This will stop the following email from being sent to the Administrator's Email in Settings > General:

From: WordPress <wordpress@example.com>
To: admin@example.com
Subject: [WordPress] Password Changed

Password changed for user: username

Suppressing this email notification has to handled with a plugin because pluggable.php is loaded earlier than a theme's functions.php file.


If you wish to instead disable User email notification that a user has successfully changed their own password, use the following filter placed in functions.php:

/**
 * Disable User Notification of Password Change Confirmation
 */
add_filter( 'send_password_change_email', '__return_false' );

This will suppress the following email from being sent:

From: WordPress <wordpress@example.com>
To: username@example.com
Subject: [WordPress] Password Changed

Hi username,

This notice confirms that your password was changed on WordPress.

If you did not change your password, please contact the Site Administrator at admin@example.com

This email has been sent to username@example.com

Regards,
All at WordPress
http://example.com/

2

WordPress sends the notification by default when the user is updated with wp_update_user().

Trying to overwrite this using filters, modifying pluggable.php, or overwriting with an empty function, doesn't work.

Instead use wp_set_password( $password, $user_id ) when you don't want the notification e-mail to be triggered for users/admins on a password reset.

2

Other answers are wrong because those disable sending email when email is changed, not when password is changed.

Adding the code below into your functions.php file under your active theme (or alternatively in a plugin) should work. Worked for me for version 4.6.1

/**
 * Disable sending of the password change email
 */
add_filter( 'send_password_change_email', '__return_false' );

See official documentation

0

Copy this following code and save as disable_email.php . Then place that file in "wp-content/plugins/" directory. And active from Admin Panel.

<?php
/*
Plugin Name: Stop email change password
Description: Whatever
*/

if (!function_exists('wp_password_change_notification')) {
    function wp_password_change_notification($user) {
        return;
    }
}
?>
  • ??? How is this different of what I did? – Interactive Oct 23 '15 at 8:57
  • Have you made a plugin and placed your code on that ? – Sabbir Hasan Oct 23 '15 at 9:05
  • Yes that is what I thought I described. But I'll update the question if it wasn't clear! – Interactive Oct 23 '15 at 9:09
  • try now. I updated the answer. It should work now ! – Sabbir Hasan Oct 23 '15 at 9:13
  • Ha I just found and tried this but didn't work! – Interactive Oct 23 '15 at 9:15
0

Use the function wp_set_password() instead of wp_update_user() to update the password as this won't trigger an email notification.

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.