This code snippet disables emails sent by WordPress after automatic updates.
When automatic updates to the WordPress core, plugins, or themes occur, WordPress typically sends an email to notify the site administrator of the changes. These emails can become excessive, particularly if you have a lot of plugins or themes installed.
By adding these filters to your theme’s functions.php file or a custom functionality plugin, you can stop these emails. This is achieved by returning false
from the auto_core_update_send_email
, auto_plugin_update_send_email
, and auto_theme_update_send_email
filters, respectively, effectively disabling the email functionality for these updates.
PHP
// Disable auto-update emails.
add_filter( 'auto_core_update_send_email', '__return_false' );
// Disable auto-update emails for plugins.
add_filter( 'auto_plugin_update_send_email', '__return_false' );
// Disable auto-update emails for themes.
add_filter( 'auto_theme_update_send_email', '__return_false' );