Skip to content

Instantly share code, notes, and snippets.

@pstoute
Last active June 8, 2023 17:38
Show Gist options
  • Save pstoute/2b5b4e8a5d534e5bbc7a3f17f330e4b5 to your computer and use it in GitHub Desktop.
Save pstoute/2b5b4e8a5d534e5bbc7a3f17f330e4b5 to your computer and use it in GitHub Desktop.
This snippet is used to prevent the emails that are sent when things are auto updated within WordPress
<?php
/**
* Disable Auto Update Emails
*
* Plugin Name: Disable Auto Update Emails
* Description: Disable the emails that are sent when plugins, themes, and WP Core are auto updated.
* Version: 0.1.0
* Author: Paul Stoute
* Author URI: https://stoute.co
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
*/
// Stop the auto update emails for WP Core updates
add_filter( 'auto_core_update_send_email', 'wpb_stop_auto_update_emails', 10, 4 );
function stop_update_emails( $send, $type, $core_update, $result ) {
if ( ! empty( $type ) && $type == 'success' ) {
return false;
}
return true;
}
// Stop the auto update emails for plugins
add_filter( 'auto_plugin_update_send_email', '__return_false' );
// Stop the auto update emails for themes
add_filter( 'auto_theme_update_send_email', '__return_false' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment