Você está visualizando atualmente WooCommerce: Disable “Password Changed” Administrator Emails

WooCommerce: Disable “Password Changed” Administrator Emails

  • Autor do post:
  • Categoria do post:Woocommerce
  • Tempo de leitura:4 minutos de leitura

The “Password Changed” email is – actually – a WordPress core notification. It goes to admins when a WordPress user changes their password, and the email body says something along the lines of “Password changed for user: XYZ“.

So, why are we saying this email notification can be stopped if you run a WooCommerce website? Well, because WooCommerce provides us developers with a handy filter, that we can use for this exact reason.

For what concerns my own experience, I use Sendgrid to deliver Business Bloomer WordPress/WooCommerce emails – and on the free plan I have a limit of 100 daily emails. Which means I needed to find a way to reduce the number of email notifications.

Today we’ll cover the “Password Changed” one – let’s see how to stop administrators from getting them!

Here’s the not-very-helpful email that WooCommerce/WordPress admins get when a user resets their password. If you wish to get rid of them, use the 1-liner below!

PHP Snippet: Disable “Password Changed” Admin Email Notification (WordPress)

The WooCommerce plugin comes with this handy function, which triggers on the My Account page:

/** * Handles resetting the user’s password. * * @param object $user The user. * @param string $new_pass New password for the user in plaintext. */ public static function reset_password( $user, $new_pass ) { do_action( ‘password_reset’, $user, $new_pass ); wp_set_password( $new_pass, $user->ID ); self::set_reset_password_cookie(); if ( ! apply_filters( ‘woocommerce_disable_password_change_notification’, false ) ) { wp_password_change_notification( $user ); } }

This means we can use the ‘woocommerce_disable_password_change_notification‘ filter if we wish to disable the Password Changed emails:

/** * @snippet Disable “Password Changed” Admin Emails * @how-to Get CustomizeWoo.com FREE * @author Rodolfo Melogli * @compatible WooCommerce 8 * @donate $9 https://businessbloomer.com/bloomer-armada/ */ add_filter( ‘woocommerce_disable_password_change_notification’, ‘__return_true’ );

Where to add custom code?

You should place PHP snippets at the bottom of your child theme functions.php file and CSS at the bottom of its style.css file. Make sure you know what you are doing when editing such files – if you need more guidance, please take a look at my guide “Should I Add Custom Code Via WP Editor, FTP or Code Snippets?” and my video tutorial “Where to Place WooCommerce Customization?”

Does this snippet (still) work?

Please let me know in the comments if everything went as expected. I would be happy to revise the snippet if you report otherwise (please provide screenshots). I have tested this code with Storefront theme, the WooCommerce version listed above and a WordPress-friendly hosting.

If you think this code saved you time & money, feel free to join 17,000+ WooCommerce Weekly subscribers for blog post updates and 250+ Business Bloomer supporters for 365 days of WooCommerce benefits. Thank you in advance!

Need Help with WooCommerce?

Check out these free video tutorials. You can learn how to customize WooCommerce without unnecessary plugins, how to properly configure the WooCommerce plugin settings and even how to master WooCommerce troubleshooting in case of a bug!

Rodolfo Melogli

Business Bloomer Founder

Author, WooCommerce expert and WordCamp speaker, Rodolfo has worked as an independent WooCommerce freelancer since 2011. His goal is to help entrepreneurs and developers overcome their WooCommerce nightmares. Rodolfo loves travelling, chasing tennis & soccer balls and, of course, wood fired oven pizza.

Follow @rmelogli

Post navigation