Only get auto-update emails when something fails
Stop WordPress emailing you after every successful automatic update of core, plugins or themes. Failure emails still arrive.
// Only email about automatic core updates when something needs attention.
add_filter(
'auto_core_update_send_email',
function ( $send, $type ) {
return 'success' === $type ? false : $send;
},
10,
2
);
// Only email about plugin and theme auto-updates when at least one failed.
function snipfire_only_failed_update_emails( $send, $update_results ) {
foreach ( (array) $update_results as $result ) {
if ( isset( $result->result ) && true !== $result->result ) {
return $send;
}
}
return false;
}
add_filter( 'auto_plugin_update_send_email', 'snipfire_only_failed_update_emails', 10, 2 );
add_filter( 'auto_theme_update_send_email', 'snipfire_only_failed_update_emails', 10, 2 );
What it does
With auto-updates on, WordPress sends an email after every update run. On a busy site that means several emails a week that need no action.
This snippet stops the "successfully updated" emails for WordPress core, plugins and themes. If any update fails, or a core update needs attention, you still get the email.
Good to know
- Nothing changes about which updates run. Only the emails change.