The following code shows to disable automatic update plugin emails on success.
One can get a lot of emails when the Enable plugin auto-updates is turned on.
Here is code to turn off the emails. Thanks to Andy for sharing the link to the code!
Sends plugin update emails only when at least one plugin update has failed.
add_filter( 'auto_plugin_update_send_email', 'plugin_update_email_on_failure', 10, 2 );
/**
* Sends plugin update emails only when at least one plugin update has failed.
* Thanks to Colin @costdev on Slack. https://wordpress.slack.com/archives/CULBN711P/p1656468319331729
*
* @param bool $enabled Whether the plugin update email is enabled.
* @param array $update_results An array of update results.
* @return bool
*/
function plugin_update_email_on_failure( $enabled, $update_results ) {
foreach ( $update_results as $update_result ) {
if ( false === $update_result->result ) {
return true;
}
}
return false;
}
Another code that can be used is located here:
https://gist.github.com/afragen/e2f40ed2e71e590a127e8adc1db05948#file-stop-auto-update-success-email-php
Code is usually added to the child theme functions file or a code snippet plugin.
Resource:
https://github.com/afragen/wordpress-beta-tester/blob/develop/src/WPBT/WPBT_Extras.php#L336-L369
Thanks to Andy, John and Colin for sharing code!
To use a plugin
Download this gist code as a plugin and upload it to a site: https://gist.github.com/afragen/e2f40ed2e71e590a127e8adc1db05948
A search at WordPress.org plugin reposistory.
disable auto update emails WordPress plugin repository
I decided to also test: Disable Theme and Plugin Auto-Update Emails by KZeni
Resources
https://qodeinteractive.com/magazine/how-to-disable-automatic-update-emails-in-wordpress/