How to Stop Password Changed Emails from Being Sent to WordPress Site Admins on WooCommerce Sites

WordPress Tweaks

On WordPress sites with a lot of user logins, it can be annoying as the site administrator to constantly be receiving “Password Changed” email notifications each time that a customer forgets their password and goes through the process of resetting it.

To disable these emails from being sent out to admins after a “Lost Password” reset is completed from the default WordPress login screen, one can add a snippet of code to remove the “wp_password_change_notification” function from the “after_password_reset” hook:

remove_action( 'after_password_reset', 'wp_password_change_notification' );

This works well on sites that do not use WooCommerce.

However, on eCommerce websites using the popular WooCommerce plugin, the above snippet does not stop the “Password Changed” emails from being sent out to site admins when a customer resets their password through their “My Account” area.

To disable WooCommerce triggering the sending out of this notification, there is a dedicated hook provided since version 3.8 called “woocommerce_disable_password_change_notification”. Simply return a true value to activate this hook:

add_filter( 'woocommerce_disable_password_change_notification', '__return_true' );

Combining both of these statements together provides a simple and effective snippet of code for helping site admins avoid receiving a plethora of annoying “Password Changed” from customers resetting their passwords:

remove_action( 'after_password_reset', 'wp_password_change_notification' );
add_filter( 'woocommerce_disable_password_change_notification', '__return_true' );

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Notify me of followup comments via e-mail. You can also subscribe without commenting.