Using WordPress ‘auto_plugin_update_send_email’ PHP filter

The auto_plugin_update_send_email WordPress PHP filter allows you to control if an email should be sent after an automatic background plugin update.


add_filter('auto_plugin_update_send_email', 'my_custom_auto_plugin_update_send_email', 10, 2);

function my_custom_auto_plugin_update_send_email($enabled, $update_results) {
  // your custom code here
  return $enabled;


  • $enabled (bool): True if plugin update notifications are enabled, false otherwise.
  • $update_results (array): The results of plugins update tasks.

More information

See WordPress Developer Resources: auto_plugin_update_send_email


Disable Email Notifications for All Plugin Updates

Prevent email notifications for all automatic plugin updates.

add_filter('auto_plugin_update_send_email', '__return_false');

Enable Email Notifications Only for Specific Plugins

Send email notifications only for updates of specific plugins.

add_filter('auto_plugin_update_send_email', 'enable_specific_plugin_update_emails', 10, 2);

function enable_specific_plugin_update_emails($enabled, $update_results) {
  $allowed_plugins = array('plugin-slug-1', 'plugin-slug-2');

  foreach ($update_results as $result) {
    if (in_array($result->item->slug, $allowed_plugins)) {
      return true;

  return false;

Disable Email Notifications for Failed Updates

Do not send email notifications if any plugin update has failed.

add_filter('auto_plugin_update_send_email', 'disable_failed_plugin_update_emails', 10, 2);

function disable_failed_plugin_update_emails($enabled, $update_results) {
  foreach ($update_results as $result) {
    if ($result->result && is_wp_error($result->result)) {
      return false;

  return $enabled;

Customize Email Subject for Plugin Update Notifications

Modify the email subject for plugin update notifications.

add_filter('auto_plugin_update_send_email', 'customize_plugin_update_email_subject', 10, 3);

function customize_plugin_update_email_subject($enabled, $update_results, $email) {
  $email['subject'] = 'Customized Subject for Plugin Update Email';
  return $email;

Log Plugin Update Results

Log the results of plugin updates to a custom file.

add_filter('auto_plugin_update_send_email', 'log_plugin_update_results', 10, 2);

function log_plugin_update_results($enabled, $update_results) {
  $log_file = WP_CONTENT_DIR . '/plugin-update-log.txt';
  $log_data = "Plugin Update Results:\n" . print_r($update_results, true) . "\n\n";

  file_put_contents($log_file, $log_data, FILE_APPEND);

  return $enabled;