wppaste
WordPress

WP_Automatic_Updater::send_plugin_theme_email( string $type, array $successful_updates, array $failed_updates )

Since
5.5.0
Source
wp-admin/includes/class-wp-automatic-updater.php:1224
Sends an email upon the completion or failure of a plugin or theme background update.

Compatibility

WordPress
since 5.5.0
PHP
7.4–8.6-dev
  • 6.7.7
  • 6.8.8
  • 6.9.7
  • 7.0.4
  • 7.1.0

Present in every tracked release (6.7.7 to 7.1.0), and compiles on PHP 7.4 through 8.6-dev.

Parameters

$typestring
The type of email to send. Can be one of 'success', 'fail', 'mixed'.
$successful_updatesarray
A list of updates that succeeded.
$failed_updatesarray
A list of updates that failed.

Performance profile

How much work a call to WP_Automatic_Updater::send_plugin_theme_email() does, and what it touches: the algorithmic scaling, the Zend instruction count per call across PHP versions, the hooks it hands control to, and the core code that calls it. Measured from the compiled opcodes, not a stopwatch, so every number is identical on any machine running the same PHP version, and every function in core is ranked by cost.

Cost class
Expensive

Sends mail via wp_mail().

Scaling
Scales with input

The body loops, so the work grows with what you pass in.

Instructions
125–210

Executed per call on PHP 8.5, depending on the branch taken. The body compiles to 560.

Plugin surface
1 hook

Third-party callbacks on 'auto_plugin_theme_update_email' run inside this call, and their cost is not bounded by anything here.

Called by
1

1 place in core call this, so the cost is paid more often than your own code shows.

What it touches

  • optionoption read or writeget_option()called directly
  • hookthird-party callbacksapply_filters()called directly
  • mailsends mailwp_mail()called directly
  • cacheobject cachewp_cache_get()one call below WP_Automatic_Updater::send_plugin_theme_email()
  • serializeserialisationmaybe_unserialize()one call below WP_Automatic_Updater::send_plugin_theme_email()

Further down the call graph this can also reach query and transient. Those are the worst case, several calls deep and usually down an error path, not what a normal call pays.

What one call costs · 60 distinct outcomes

One number would be a lie: the work depends on which branch runs. These are every distinct cost WP_Automatic_Updater::send_plugin_theme_email() can have, taken from its control-flow graph on PHP 8.5.

WhenInstructionsCalls it makes
!empty($successful_updates) && $type !== "fail" && !$type125–131get_option(), __(), __(), home_url(), sprintf(), __(), __(), __(), get_option(), home_url(), parse_url(), get_site_option(), sprintf(), compact(), apply_filters(), wp_specialchars_decode(), wp_mail()
!empty($successful_updates) && $type !== "fail" && !$type127–133get_option(), __(), __(), home_url(), sprintf(), __(), __(), __(), get_option(), get_option(), wp_specialchars_decode(), get_site_option(), sprintf(), compact(), apply_filters(), wp_specialchars_decode(), wp_mail()
!empty($successful_updates) && $type !== "fail" && !$type129–135get_option(), __(), __(), home_url(), sprintf(), __(), __(), __(), get_option(), home_url(), parse_url(), get_site_option(), sprintf(), compact(), apply_filters(), wp_specialchars_decode(), wp_mail(), update_option()
!empty($successful_updates) && $type !== "fail" && !$type131–137get_option(), __(), __(), home_url(), sprintf(), __(), __(), __(), get_option(), get_option(), wp_specialchars_decode(), get_site_option(), sprintf(), compact(), apply_filters(), wp_specialchars_decode(), wp_mail(), update_option()
!empty($successful_updates) && $type !== "fail" && $type138–144get_option(), __(), __(), home_url(), sprintf(), __(), __(), __(), __(), get_option(), home_url(), parse_url(), get_site_option(), sprintf(), compact(), apply_filters(), wp_specialchars_decode(), wp_mail()
!empty($successful_updates) && $type !== "fail" && !$type139–145get_option(), __(), __(), home_url(), sprintf(), __(), admin_url(), sprintf(), __(), __(), __(), get_option(), home_url(), parse_url(), get_site_option(), sprintf(), compact(), apply_filters(), wp_specialchars_decode(), wp_mail()
!empty($successful_updates) && $type !== "fail" && $type140–146get_option(), __(), __(), home_url(), sprintf(), __(), __(), __(), __(), get_option(), get_option(), wp_specialchars_decode(), get_site_option(), sprintf(), compact(), apply_filters(), wp_specialchars_decode(), wp_mail()
!empty($successful_updates) && $type !== "fail" && !$type141–147get_option(), __(), __(), home_url(), sprintf(), __(), admin_url(), sprintf(), __(), __(), __(), get_option(), get_option(), wp_specialchars_decode(), get_site_option(), sprintf(), compact(), apply_filters(), wp_specialchars_decode(), wp_mail()
!empty($successful_updates) && $type !== "fail" && $type142–148get_option(), __(), __(), home_url(), sprintf(), __(), __(), __(), __(), get_option(), home_url(), parse_url(), get_site_option(), sprintf(), compact(), apply_filters(), wp_specialchars_decode(), wp_mail(), update_option()
!empty($successful_updates) && $type !== "fail" && !$type143–149get_option(), __(), __(), home_url(), sprintf(), __(), admin_url(), sprintf(), __(), __(), __(), get_option(), home_url(), parse_url(), get_site_option(), sprintf(), compact(), apply_filters(), wp_specialchars_decode(), wp_mail(), update_option()
!empty($successful_updates) && $type !== "fail" && $type144–150get_option(), __(), __(), home_url(), sprintf(), __(), __(), __(), __(), get_option(), get_option(), wp_specialchars_decode(), get_site_option(), sprintf(), compact(), apply_filters(), wp_specialchars_decode(), wp_mail(), update_option()
!empty($successful_updates) && $type !== "fail" && !$type145–151get_option(), __(), __(), home_url(), sprintf(), __(), admin_url(), sprintf(), __(), __(), __(), get_option(), get_option(), wp_specialchars_decode(), get_site_option(), sprintf(), compact(), apply_filters(), wp_specialchars_decode(), wp_mail(), update_option()
48 further outcomes, up to 210 instructions
!empty($successful_updates) && $type !== "fail" && $type148–155get_option(), __(), __(), home_url(), sprintf(), __(), __(), __(), __(), __(), get_option(), home_url(), parse_url(), get_site_option(), sprintf(), compact(), apply_filters(), wp_specialchars_decode(), wp_mail()
!empty($successful_updates) && $type !== "fail" && $type150–157get_option(), __(), __(), home_url(), sprintf(), __(), __(), __(), __(), __(), get_option(), get_option(), wp_specialchars_decode(), get_site_option(), sprintf(), compact(), apply_filters(), wp_specialchars_decode(), wp_mail()
!empty($successful_updates) && $type !== "fail" && $type152–159get_option(), __(), __(), home_url(), sprintf(), __(), __(), __(), __(), __(), get_option(), home_url(), parse_url(), get_site_option(), sprintf(), compact(), apply_filters(), wp_specialchars_decode(), wp_mail(), update_option()
!empty($successful_updates) && $type !== "fail" && $type152–158get_option(), __(), __(), home_url(), sprintf(), __(), __(), admin_url(), sprintf(), __(), __(), __(), get_option(), home_url(), parse_url(), get_site_option(), sprintf(), compact(), apply_filters(), wp_specialchars_decode(), wp_mail()
!empty($successful_updates) && $type !== "fail" && !$type153–159get_option(), __(), __(), home_url(), sprintf(), __(), admin_url(), sprintf(), __(), admin_url(), sprintf(), __(), __(), __(), get_option(), home_url(), parse_url(), get_site_option(), sprintf(), compact(), apply_filters(), wp_specialchars_decode(), wp_mail()
!empty($successful_updates) && $type !== "fail" && $type154–161get_option(), __(), __(), home_url(), sprintf(), __(), __(), __(), __(), __(), get_option(), get_option(), wp_specialchars_decode(), get_site_option(), sprintf(), compact(), apply_filters(), wp_specialchars_decode(), wp_mail(), update_option()
!empty($successful_updates) && $type !== "fail" && $type154–160get_option(), __(), __(), home_url(), sprintf(), __(), __(), admin_url(), sprintf(), __(), __(), __(), get_option(), get_option(), wp_specialchars_decode(), get_site_option(), sprintf(), compact(), apply_filters(), wp_specialchars_decode(), wp_mail()
!empty($successful_updates) && $type !== "fail" && !$type155–161get_option(), __(), __(), home_url(), sprintf(), __(), admin_url(), sprintf(), __(), admin_url(), sprintf(), __(), __(), __(), get_option(), get_option(), wp_specialchars_decode(), get_site_option(), sprintf(), compact(), apply_filters(), wp_specialchars_decode(), wp_mail()
!empty($successful_updates) && $type !== "fail" && $type156–162get_option(), __(), __(), home_url(), sprintf(), __(), __(), admin_url(), sprintf(), __(), __(), __(), get_option(), home_url(), parse_url(), get_site_option(), sprintf(), compact(), apply_filters(), wp_specialchars_decode(), wp_mail(), update_option()
!empty($successful_updates) && $type !== "fail" && !$type157–163get_option(), __(), __(), home_url(), sprintf(), __(), admin_url(), sprintf(), __(), admin_url(), sprintf(), __(), __(), __(), get_option(), home_url(), parse_url(), get_site_option(), sprintf(), compact(), apply_filters(), wp_specialchars_decode(), wp_mail(), update_option()
!empty($successful_updates) && $type !== "fail" && $type158–164get_option(), __(), __(), home_url(), sprintf(), __(), __(), admin_url(), sprintf(), __(), __(), __(), get_option(), get_option(), wp_specialchars_decode(), get_site_option(), sprintf(), compact(), apply_filters(), wp_specialchars_decode(), wp_mail(), update_option()
!empty($successful_updates) && $type !== "fail" && !$type159–165get_option(), __(), __(), home_url(), sprintf(), __(), admin_url(), sprintf(), __(), admin_url(), sprintf(), __(), __(), __(), get_option(), get_option(), wp_specialchars_decode(), get_site_option(), sprintf(), compact(), apply_filters(), wp_specialchars_decode(), wp_mail(), update_option()
!empty($successful_updates) && $type !== "fail" && $type162–169get_option(), __(), __(), home_url(), sprintf(), __(), __(), __(), admin_url(), sprintf(), __(), __(), __(), get_option(), home_url(), parse_url(), get_site_option(), sprintf(), compact(), apply_filters(), wp_specialchars_decode(), wp_mail()
!empty($successful_updates) && $type !== "fail" && $type && empty($failed_updates)164–166get_option(), __(), __(), home_url(), sprintf(), __(), __(), __(), __(), __(), __(), get_option(), home_url(), parse_url(), get_site_option(), sprintf(), compact(), apply_filters(), wp_specialchars_decode(), wp_mail()
!empty($successful_updates) && $type !== "fail" && $type164–171get_option(), __(), __(), home_url(), sprintf(), __(), __(), __(), admin_url(), sprintf(), __(), __(), __(), get_option(), get_option(), wp_specialchars_decode(), get_site_option(), sprintf(), compact(), apply_filters(), wp_specialchars_decode(), wp_mail()
!empty($successful_updates) && $type !== "fail" && $type && empty($failed_updates)166–168get_option(), __(), __(), home_url(), sprintf(), __(), __(), __(), __(), __(), __(), get_option(), get_option(), wp_specialchars_decode(), get_site_option(), sprintf(), compact(), apply_filters(), wp_specialchars_decode(), wp_mail()
!empty($successful_updates) && $type !== "fail" && $type166–173get_option(), __(), __(), home_url(), sprintf(), __(), __(), __(), admin_url(), sprintf(), __(), __(), __(), get_option(), home_url(), parse_url(), get_site_option(), sprintf(), compact(), apply_filters(), wp_specialchars_decode(), wp_mail(), update_option()
!empty($successful_updates) && $type !== "fail" && $type166–172get_option(), __(), __(), home_url(), sprintf(), __(), __(), admin_url(), sprintf(), __(), admin_url(), sprintf(), __(), __(), __(), get_option(), home_url(), parse_url(), get_site_option(), sprintf(), compact(), apply_filters(), wp_specialchars_decode(), wp_mail()
!empty($successful_updates) && $type !== "fail" && $type && empty($failed_updates)168–170get_option(), __(), __(), home_url(), sprintf(), __(), __(), __(), __(), __(), __(), get_option(), home_url(), parse_url(), get_site_option(), sprintf(), compact(), apply_filters(), wp_specialchars_decode(), wp_mail(), update_option()
!empty($successful_updates) && $type !== "fail" && $type168–175get_option(), __(), __(), home_url(), sprintf(), __(), __(), __(), admin_url(), sprintf(), __(), __(), __(), get_option(), get_option(), wp_specialchars_decode(), get_site_option(), sprintf(), compact(), apply_filters(), wp_specialchars_decode(), wp_mail(), update_option()
!empty($successful_updates) && $type !== "fail" && $type168–174get_option(), __(), __(), home_url(), sprintf(), __(), __(), admin_url(), sprintf(), __(), admin_url(), sprintf(), __(), __(), __(), get_option(), get_option(), wp_specialchars_decode(), get_site_option(), sprintf(), compact(), apply_filters(), wp_specialchars_decode(), wp_mail()
!empty($successful_updates) && $type !== "fail" && $type && empty($failed_updates)170–172get_option(), __(), __(), home_url(), sprintf(), __(), __(), __(), __(), __(), __(), get_option(), get_option(), wp_specialchars_decode(), get_site_option(), sprintf(), compact(), apply_filters(), wp_specialchars_decode(), wp_mail(), update_option()
!empty($successful_updates) && $type !== "fail" && $type170–176get_option(), __(), __(), home_url(), sprintf(), __(), __(), admin_url(), sprintf(), __(), admin_url(), sprintf(), __(), __(), __(), get_option(), home_url(), parse_url(), get_site_option(), sprintf(), compact(), apply_filters(), wp_specialchars_decode(), wp_mail(), update_option()
!empty($successful_updates) && $type !== "fail" && $type172–178get_option(), __(), __(), home_url(), sprintf(), __(), __(), admin_url(), sprintf(), __(), admin_url(), sprintf(), __(), __(), __(), get_option(), get_option(), wp_specialchars_decode(), get_site_option(), sprintf(), compact(), apply_filters(), wp_specialchars_decode(), wp_mail(), update_option()
!empty($successful_updates) && $type !== "fail" && $type && $failed_updates174–176get_option(), __(), __(), home_url(), sprintf(), __(), __(), __(), __(), __(), __(), __(), get_option(), home_url(), parse_url(), get_site_option(), sprintf(), compact(), apply_filters(), wp_specialchars_decode(), wp_mail()
!empty($successful_updates) && $type !== "fail" && $type && $failed_updates176–178get_option(), __(), __(), home_url(), sprintf(), __(), __(), __(), __(), __(), __(), __(), get_option(), get_option(), wp_specialchars_decode(), get_site_option(), sprintf(), compact(), apply_filters(), wp_specialchars_decode(), wp_mail()
!empty($successful_updates) && $type !== "fail" && $type176–183get_option(), __(), __(), home_url(), sprintf(), __(), __(), __(), admin_url(), sprintf(), __(), admin_url(), sprintf(), __(), __(), __(), get_option(), home_url(), parse_url(), get_site_option(), sprintf(), compact(), apply_filters(), wp_specialchars_decode(), wp_mail()
!empty($successful_updates) && $type !== "fail" && $type && $failed_updates178–180get_option(), __(), __(), home_url(), sprintf(), __(), __(), __(), __(), __(), __(), __(), get_option(), home_url(), parse_url(), get_site_option(), sprintf(), compact(), apply_filters(), wp_specialchars_decode(), wp_mail(), update_option()
!empty($successful_updates) && $type !== "fail" && $type && empty($failed_updates)178–180get_option(), __(), __(), home_url(), sprintf(), __(), __(), __(), __(), admin_url(), sprintf(), __(), __(), __(), get_option(), home_url(), parse_url(), get_site_option(), sprintf(), compact(), apply_filters(), wp_specialchars_decode(), wp_mail()
!empty($successful_updates) && $type !== "fail" && $type178–185get_option(), __(), __(), home_url(), sprintf(), __(), __(), __(), admin_url(), sprintf(), __(), admin_url(), sprintf(), __(), __(), __(), get_option(), get_option(), wp_specialchars_decode(), get_site_option(), sprintf(), compact(), apply_filters(), wp_specialchars_decode(), wp_mail()
!empty($successful_updates) && $type !== "fail" && $type && $failed_updates180–182get_option(), __(), __(), home_url(), sprintf(), __(), __(), __(), __(), __(), __(), __(), get_option(), get_option(), wp_specialchars_decode(), get_site_option(), sprintf(), compact(), apply_filters(), wp_specialchars_decode(), wp_mail(), update_option()
!empty($successful_updates) && $type !== "fail" && $type && empty($failed_updates)180–182get_option(), __(), __(), home_url(), sprintf(), __(), __(), __(), __(), admin_url(), sprintf(), __(), __(), __(), get_option(), get_option(), wp_specialchars_decode(), get_site_option(), sprintf(), compact(), apply_filters(), wp_specialchars_decode(), wp_mail()
!empty($successful_updates) && $type !== "fail" && $type180–187get_option(), __(), __(), home_url(), sprintf(), __(), __(), __(), admin_url(), sprintf(), __(), admin_url(), sprintf(), __(), __(), __(), get_option(), home_url(), parse_url(), get_site_option(), sprintf(), compact(), apply_filters(), wp_specialchars_decode(), wp_mail(), update_option()
!empty($successful_updates) && $type !== "fail" && $type && empty($failed_updates)182–184get_option(), __(), __(), home_url(), sprintf(), __(), __(), __(), __(), admin_url(), sprintf(), __(), __(), __(), get_option(), home_url(), parse_url(), get_site_option(), sprintf(), compact(), apply_filters(), wp_specialchars_decode(), wp_mail(), update_option()
!empty($successful_updates) && $type !== "fail" && $type182–189get_option(), __(), __(), home_url(), sprintf(), __(), __(), __(), admin_url(), sprintf(), __(), admin_url(), sprintf(), __(), __(), __(), get_option(), get_option(), wp_specialchars_decode(), get_site_option(), sprintf(), compact(), apply_filters(), wp_specialchars_decode(), wp_mail(), update_option()
!empty($successful_updates) && $type !== "fail" && $type && empty($failed_updates)184–186get_option(), __(), __(), home_url(), sprintf(), __(), __(), __(), __(), admin_url(), sprintf(), __(), __(), __(), get_option(), get_option(), wp_specialchars_decode(), get_site_option(), sprintf(), compact(), apply_filters(), wp_specialchars_decode(), wp_mail(), update_option()
!empty($successful_updates) && $type !== "fail" && $type && $failed_updates188–190get_option(), __(), __(), home_url(), sprintf(), __(), __(), __(), __(), __(), admin_url(), sprintf(), __(), __(), __(), get_option(), home_url(), parse_url(), get_site_option(), sprintf(), compact(), apply_filters(), wp_specialchars_decode(), wp_mail()
!empty($successful_updates) && $type !== "fail" && $type && $failed_updates190–192get_option(), __(), __(), home_url(), sprintf(), __(), __(), __(), __(), __(), admin_url(), sprintf(), __(), __(), __(), get_option(), get_option(), wp_specialchars_decode(), get_site_option(), sprintf(), compact(), apply_filters(), wp_specialchars_decode(), wp_mail()
!empty($successful_updates) && $type !== "fail" && $type && $failed_updates192–194get_option(), __(), __(), home_url(), sprintf(), __(), __(), __(), __(), __(), admin_url(), sprintf(), __(), __(), __(), get_option(), home_url(), parse_url(), get_site_option(), sprintf(), compact(), apply_filters(), wp_specialchars_decode(), wp_mail(), update_option()
!empty($successful_updates) && $type !== "fail" && $type && empty($failed_updates)192–194get_option(), __(), __(), home_url(), sprintf(), __(), __(), __(), __(), admin_url(), sprintf(), __(), admin_url(), sprintf(), __(), __(), __(), get_option(), home_url(), parse_url(), get_site_option(), sprintf(), compact(), apply_filters(), wp_specialchars_decode(), wp_mail()
!empty($successful_updates) && $type !== "fail" && $type && $failed_updates194–196get_option(), __(), __(), home_url(), sprintf(), __(), __(), __(), __(), __(), admin_url(), sprintf(), __(), __(), __(), get_option(), get_option(), wp_specialchars_decode(), get_site_option(), sprintf(), compact(), apply_filters(), wp_specialchars_decode(), wp_mail(), update_option()
!empty($successful_updates) && $type !== "fail" && $type && empty($failed_updates)194–196get_option(), __(), __(), home_url(), sprintf(), __(), __(), __(), __(), admin_url(), sprintf(), __(), admin_url(), sprintf(), __(), __(), __(), get_option(), get_option(), wp_specialchars_decode(), get_site_option(), sprintf(), compact(), apply_filters(), wp_specialchars_decode(), wp_mail()
!empty($successful_updates) && $type !== "fail" && $type && empty($failed_updates)196–198get_option(), __(), __(), home_url(), sprintf(), __(), __(), __(), __(), admin_url(), sprintf(), __(), admin_url(), sprintf(), __(), __(), __(), get_option(), home_url(), parse_url(), get_site_option(), sprintf(), compact(), apply_filters(), wp_specialchars_decode(), wp_mail(), update_option()
!empty($successful_updates) && $type !== "fail" && $type && empty($failed_updates)198–200get_option(), __(), __(), home_url(), sprintf(), __(), __(), __(), __(), admin_url(), sprintf(), __(), admin_url(), sprintf(), __(), __(), __(), get_option(), get_option(), wp_specialchars_decode(), get_site_option(), sprintf(), compact(), apply_filters(), wp_specialchars_decode(), wp_mail(), update_option()
!empty($successful_updates) && $type !== "fail" && $type && $failed_updates202–204get_option(), __(), __(), home_url(), sprintf(), __(), __(), __(), __(), __(), admin_url(), sprintf(), __(), admin_url(), sprintf(), __(), __(), __(), get_option(), home_url(), parse_url(), get_site_option(), sprintf(), compact(), apply_filters(), wp_specialchars_decode(), wp_mail()
!empty($successful_updates) && $type !== "fail" && $type && $failed_updates204–206get_option(), __(), __(), home_url(), sprintf(), __(), __(), __(), __(), __(), admin_url(), sprintf(), __(), admin_url(), sprintf(), __(), __(), __(), get_option(), get_option(), wp_specialchars_decode(), get_site_option(), sprintf(), compact(), apply_filters(), wp_specialchars_decode(), wp_mail()
!empty($successful_updates) && $type !== "fail" && $type && $failed_updates206–208get_option(), __(), __(), home_url(), sprintf(), __(), __(), __(), __(), __(), admin_url(), sprintf(), __(), admin_url(), sprintf(), __(), __(), __(), get_option(), home_url(), parse_url(), get_site_option(), sprintf(), compact(), apply_filters(), wp_specialchars_decode(), wp_mail(), update_option()
!empty($successful_updates) && $type !== "fail" && $type && $failed_updates208–210get_option(), __(), __(), home_url(), sprintf(), __(), __(), __(), __(), __(), admin_url(), sprintf(), __(), admin_url(), sprintf(), __(), __(), __(), get_option(), get_option(), wp_specialchars_decode(), get_site_option(), sprintf(), compact(), apply_filters(), wp_specialchars_decode(), wp_mail(), update_option()

This body has more branch combinations than are worth enumerating, so the table covers the outcomes found first rather than every one that exists.

Across PHP versions

PHPCompiledExecutedBranchesNotes
8.6-dev560125–21044
8.5560125–21044
8.4560125–210443 fewer instructions than PHP 8.3
8.3563128–21344
8.2563128–213441 more instruction than PHP 8.1
8.1562128–21344
7.4562128–21344

An instruction is not a fixed amount of time, so a matching count is not necessarily the same speed; what it rules out is a difference in the work itself.

Hooks and filters fired · 1

One hook fires while WP_Automatic_Updater::send_plugin_theme_email() runs, in this order:

  1. apply_filters( auto_plugin_theme_update_email )filterline 1522 (+298 into the body)

    Filters the email sent following an automatic background update for plugins and themes.

Uses · 10

  • get_option()Retrieves an option value based on an option name.
  • __()Retrieves the translation of $text.
  • home_url()Retrieves the URL for the current site where the front end is accessible.
  • esc_url()Checks and cleans a URL.
  • admin_url()Retrieves the URL to the admin area for the current site.
  • wp_specialchars_decode()Converts a number of HTML entities into their special characters.
  • get_site_option()Retrieve an option value for the current network based on name of option.
  • apply_filters()Calls the callback functions that have been added to a filter hook.
  • wp_mail()Sends an email, similar to PHP's mail function.
  • update_option()Updates the value of an option that was already added.

Used by · 1

Source code

	protected function send_plugin_theme_email( $type, $successful_updates, $failed_updates ) {		// No updates were attempted.		if ( empty( $successful_updates ) && empty( $failed_updates ) ) {			return;		} 		$unique_failures     = false;		$past_failure_emails = get_option( 'auto_plugin_theme_update_emails', array() ); 		/*		 * When only failures have occurred, an email should only be sent if there are unique failures.		 * A failure is considered unique if an email has not been sent for an update attempt failure		 * to a plugin or theme with the same new_version.		 */		if ( 'fail' === $type ) {			foreach ( $failed_updates as $update_type => $failures ) {				foreach ( $failures as $failed_update ) {					if ( ! isset( $past_failure_emails[ $failed_update->item->{$update_type} ] ) ) {						$unique_failures = true;						continue;					} 					// Check that the failure represents a new failure based on the new_version.					if ( version_compare( $past_failure_emails[ $failed_update->item->{$update_type} ], $failed_update->item->new_version, '<' ) ) {						$unique_failures = true;					}				}			} 			if ( ! $unique_failures ) {				return;			}		} 		$body               = array();		$successful_plugins = ( ! empty( $successful_updates['plugin'] ) );		$successful_themes  = ( ! empty( $successful_updates['theme'] ) );		$failed_plugins     = ( ! empty( $failed_updates['plugin'] ) );		$failed_themes      = ( ! empty( $failed_updates['theme'] ) ); 		switch ( $type ) {			case 'success':				if ( $successful_plugins && $successful_themes ) {					/* translators: %s: Site title. */					$subject = __( '[%s] Some plugins and themes have automatically updated' );					$body[]  = sprintf(						/* translators: %s: Home URL. */						__( 'Howdy! Some plugins and themes have automatically updated to their latest versions on your site at %s. No further action is needed on your part.' ),						home_url()					);				} elseif ( $successful_plugins ) {					/* translators: %s: Site title. */					$subject = __( '[%s] Some plugins were automatically updated' );					$body[]  = sprintf(						/* translators: %s: Home URL. */						__( 'Howdy! Some plugins have automatically updated to their latest versions on your site at %s. No further action is needed on your part.' ),						home_url()					);				} else {					/* translators: %s: Site title. */					$subject = __( '[%s] Some themes were automatically updated' );					$body[]  = sprintf(						/* translators: %s: Home URL. */						__( 'Howdy! Some themes have automatically updated to their latest versions on your site at %s. No further action is needed on your part.' ),						home_url()					);				} 				break;			case 'fail':			case 'mixed':				if ( $failed_plugins && $failed_themes ) {					/* translators: %s: Site title. */					$subject = __( '[%s] Some plugins and themes have failed to update' );					$body[]  = sprintf(						/* translators: %s: Home URL. */						__( 'Howdy! Plugins and themes failed to update on your site at %s.' ),						home_url()					);				} elseif ( $failed_plugins ) {

Changelog

Introduced in 5.5.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 6.7.7 tag, from src/wp-admin/includes/class-wp-automatic-updater.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.