How To: Disable “Some Plugins Were Automatically Updated”

Are you receiving this “Some plugins were automatically updated” e-mail a bit too often to your taste?

Why do I reveive those e-mails?

That’s because your WordPress was set to automatically update your themes and plugins. Since WordPress 5.1.1, there is also an option in the Plugins section that allows you to enable this directly for specific plugins.

How can I disable those e-mails?

Here is the code that will get you rid of those e-mails:

global $wp_version;

if ( version_compare( $wp_version, '5.5.1' ) >= 0) {
  // Only send emails when the plugin or theme failed to update.
  add_filter( 'auto_plugin_update_send_email', 'handle_auto_plugin_update_send_email', 10, 2 );
  add_filter( 'auto_theme_update_send_email', 'handle_auto_plugin_update_send_email', 10, 2 );
} 
else {
  // Disable the emails sent everytime there is a plugin or theme update.
  add_filter( 'auto_plugin_update_send_email', 'disable_auto_plugin_update_send_email', 10, 1 );
  add_filter( 'auto_theme_update_send_email', 'disable_auto_plugin_update_send_email', 10, 1 );
} 

function disable_auto_plugin_update_send_email() {
  return false;
}

function handle_auto_plugin_update_send_email( $enabled, $update_results = null ) {
  if ( is_array( $update_results ) ) {
    foreach ( $update_results as $update_result ) {
      if ( !$update_result->result ) {
        return $enabled;
      }
    }
  }
  return false;
}

This code will avoid emails to be sent, except if one plugin (or theme) couldn’t be updated successfuly.

If you don’t know how to add custom code to WordPress, please check the artile about Add Custom PHP Code to WordPress.

Little Warning

Having your plugins and themes being updated successfuly might sound great, but this is also dangerous: if there is an issue with one of them, your website might go down, and that might also happen because of some new compatibility issues. So, here is my advice:

Make sure your site has a daily backup. If not, avoid enabling Automatic Updates.