Title: WP_Automatic_Updater::after_plugin_theme_update
Published: August 11, 2020
Last modified: May 20, 2026

---

# WP_Automatic_Updater::after_plugin_theme_update( array $update_results )

## In this article

 * [Parameters](https://developer.wordpress.org/reference/classes/wp_automatic_updater/after_plugin_theme_update/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/classes/wp_automatic_updater/after_plugin_theme_update/?output_format=md#source)
 * [Hooks](https://developer.wordpress.org/reference/classes/wp_automatic_updater/after_plugin_theme_update/?output_format=md#hooks)
 * [Related](https://developer.wordpress.org/reference/classes/wp_automatic_updater/after_plugin_theme_update/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_automatic_updater/after_plugin_theme_update/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/classes/wp_automatic_updater/after_plugin_theme_update/?output_format=md#wp--skip-link--target)

Checks whether an email should be sent after attempting plugin or theme updates.

## 󠀁[Parameters](https://developer.wordpress.org/reference/classes/wp_automatic_updater/after_plugin_theme_update/?output_format=md#parameters)󠁿

 `$update_results`arrayrequired

The results of update tasks.

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wp_automatic_updater/after_plugin_theme_update/?output_format=md#source)󠁿

    ```php
    protected function after_plugin_theme_update( $update_results ) {
    	$successful_updates = array();
    	$failed_updates     = array();

    	if ( ! empty( $update_results['plugin'] ) ) {
    		/**
    		 * Filters whether to send an email following an automatic background plugin update.
    		 *
    		 * @since 5.5.0
    		 * @since 5.5.1 Added the `$update_results` parameter.
    		 *
    		 * @param bool  $enabled        True if plugin update notifications are enabled, false otherwise.
    		 * @param array $update_results The results of plugins update tasks.
    		 */
    		$notifications_enabled = apply_filters( 'auto_plugin_update_send_email', true, $update_results['plugin'] );

    		if ( $notifications_enabled ) {
    			foreach ( $update_results['plugin'] as $update_result ) {
    				if ( true === $update_result->result ) {
    					$successful_updates['plugin'][] = $update_result;
    				} else {
    					$failed_updates['plugin'][] = $update_result;
    				}
    			}
    		}
    	}

    	if ( ! empty( $update_results['theme'] ) ) {
    		/**
    		 * Filters whether to send an email following an automatic background theme update.
    		 *
    		 * @since 5.5.0
    		 * @since 5.5.1 Added the `$update_results` parameter.
    		 *
    		 * @param bool  $enabled        True if theme update notifications are enabled, false otherwise.
    		 * @param array $update_results The results of theme update tasks.
    		 */
    		$notifications_enabled = apply_filters( 'auto_theme_update_send_email', true, $update_results['theme'] );

    		if ( $notifications_enabled ) {
    			foreach ( $update_results['theme'] as $update_result ) {
    				if ( true === $update_result->result ) {
    					$successful_updates['theme'][] = $update_result;
    				} else {
    					$failed_updates['theme'][] = $update_result;
    				}
    			}
    		}
    	}

    	if ( empty( $successful_updates ) && empty( $failed_updates ) ) {
    		return;
    	}

    	if ( empty( $failed_updates ) ) {
    		$this->send_plugin_theme_email( 'success', $successful_updates, $failed_updates );
    	} elseif ( empty( $successful_updates ) ) {
    		$this->send_plugin_theme_email( 'fail', $successful_updates, $failed_updates );
    	} else {
    		$this->send_plugin_theme_email( 'mixed', $successful_updates, $failed_updates );
    	}
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/class-wp-automatic-updater.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-admin/includes/class-wp-automatic-updater.php#L1163)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-admin/includes/class-wp-automatic-updater.php#L1163-L1224)

## 󠀁[Hooks](https://developer.wordpress.org/reference/classes/wp_automatic_updater/after_plugin_theme_update/?output_format=md#hooks)󠁿

 [apply_filters( ‘auto_plugin_update_send_email’, bool $enabled, array $update_results )](https://developer.wordpress.org/reference/hooks/auto_plugin_update_send_email/)

Filters whether to send an email following an automatic background plugin update.

 [apply_filters( ‘auto_theme_update_send_email’, bool $enabled, array $update_results )](https://developer.wordpress.org/reference/hooks/auto_theme_update_send_email/)

Filters whether to send an email following an automatic background theme update.

## 󠀁[Related](https://developer.wordpress.org/reference/classes/wp_automatic_updater/after_plugin_theme_update/?output_format=md#related)󠁿

| Uses | Description | 
| [WP_Automatic_Updater::send_plugin_theme_email()](https://developer.wordpress.org/reference/classes/wp_automatic_updater/send_plugin_theme_email/)`wp-admin/includes/class-wp-automatic-updater.php` |

Sends an email upon the completion or failure of a plugin or theme background update.

  | 
| [apply_filters()](https://developer.wordpress.org/reference/functions/apply_filters/)`wp-includes/plugin.php` |

Calls the callback functions that have been added to a filter hook.

  |

| Used by | Description | 
| [WP_Automatic_Updater::run()](https://developer.wordpress.org/reference/classes/wp_automatic_updater/run/)`wp-admin/includes/class-wp-automatic-updater.php` |

Kicks off the background update process, looping through all pending updates.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wp_automatic_updater/after_plugin_theme_update/?output_format=md#changelog)󠁿

| Version | Description | 
| [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_automatic_updater%2Fafter_plugin_theme_update%2F)
before being able to contribute a note or feedback.