WordPress 5.5 appears to have broken email notification control with Easy Updates Manager. Until the team over there can fix it, here’s what’s going on behind the scenes.
Filtering Emails
Emails can be filtered by using the auto_plugin_theme_update_email
filter.
To change this email programmatically, you’d do something like this:
/**
* Filters the email sent following an automatic background update for plugins and themes.
*
* @since 5.5.0
*
* @param array $email {
* Array of email arguments that will be passed to wp_mail().
*
* @type string $to The email recipient. An array of emails
* can be returned, as handled by wp_mail().
* @type string $subject The email's subject.
* @type string $body The email message body.
* @type string $headers Any email headers, defaults to no headers.
* }
* @param string $type The type of email being sent. Can be one of 'success', 'fail', 'mixed'.
* @param array $successful_updates A list of updates that succeeded.
* @param array $failed_updates A list of updates that failed.
*/
add_filter( 'auto_plugin_theme_update_email', function( $email, $type, $successful_updates, $failed_updates ) {
$email['to'] = 'mynewemail@domain.com'; // can be array of emails or string.
return $email;
}, 10, 4 );
Code language: PHP (php)
Theme Notifications
Here’s the core code in its current form.
/**
* Filters whether to send an email following an automatic background theme update.
*
* @since 5.5.0
*
* @param bool $enabled True if notifications are enabled, false otherwise.
*/
$notifications_enabled = apply_filters( 'auto_theme_update_send_email', true );
Code language: PHP (php)
To turn these off for themes, you would just enter:
add_filter( 'auto_theme_update_send_email', '__return_false' );
Code language: PHP (php)
Plugin Notifications
Here’s the core code in its current form.
/**
* Filters whether to send an email following an automatic background plugin update.
*
* @since 5.5.0
*
* @param bool $enabled True if plugins notifications are enabled, false otherwise.
*/
$notifications_enabled = apply_filters( 'auto_plugin_update_send_email', true );
Code language: PHP (php)
To turn these off for plugins, you would enter:
add_filter( 'auto_plugin_update_send_email', '__return_false' );
Code language: PHP (php)
Translations?
I could not find a filter or method that sends translation emails. Maybe someone can request a 5.6 feature for that?
Core Emails
Core emails should continue to work with Easy Updates Manager. Here’s the core code as it appears currently.
/**
* Filters whether to send an email following an automatic background core update.
*
* @since 3.7.0
*
* @param bool $send Whether to send the email. Default true.
* @param string $type The type of email to send. Can be one of
* 'success', 'fail', 'critical'.
* @param object $core_update The update offer that was attempted.
* @param mixed $result The result for the core update. Can be WP_Error.
*/
if ( 'manual' !== $type && ! apply_filters( 'auto_core_update_send_email', true, $type, $core_update, $result ) ) {
return;
}
Code language: PHP (php)
Easy Updates Manager…
It may take a bit for the EUM team to get a 5.5 fix in place. There are extra UI components to consider now that theme/plugin/core emails are all separate now. They will also need to be backwards compatible. So this is not an enviable task.
Plugin Solution
A simple installation of this plugin will stop update email notifications.
Regards,
Ronald Huereca