Disable email notification after change of password

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

After some Googling 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 disabled 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.

Topic notifications php email pluggable plugins Wordpress

Category Web


This works for me, just clear the email address.

// Disable password change notification email.
add_filter('wp_password_change_notification_email', function ($wp_password_change_notification_email) {
    $wp_password_change_notification_email['to'] = '';
    return $wp_password_change_notification_email;
});

Should this answer https://wordpress.stackexchange.com/a/266006/73347 above still work to disable password reset emails to admins?

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

I'm still receiving them :( Thanks.


If you're using Woocommerce:

Since WC 3.8.0 (November 2019), there is now a dedicated filter hook for this:

add_filter('woocommerce_disable_password_change_notification', '__return_true');

Should suppress password change notifications.


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


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 <[email protected]>
To: [email protected]
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 <[email protected]>
To: [email protected]
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 [email protected]

This email has been sent to [email protected]

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


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


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


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.


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;
    }
}
?>

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.