From 65f08f49da45f8226481b6cb8f24724a017db2cb Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 23 Jan 2018 13:44:25 +0000 Subject: [PATCH] Email: Don't send notifications for site or network admin email address change to the default 'admin_email' value. Props tigertech, MattyRob, seanchayes. Fixes #42693. git-svn-id: https://develop.svn.wordpress.org/trunk@42570 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/functions.php | 9 ++++++++- src/wp-includes/ms-functions.php | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php index 7d41b37aef..ec5a3d26ce 100644 --- a/src/wp-includes/functions.php +++ b/src/wp-includes/functions.php @@ -5993,6 +5993,13 @@ function wp_cache_get_last_changed( $group ) { * @param string $option_name The relevant database option name. */ function wp_site_admin_email_change_notification( $old_email, $new_email, $option_name ) { + $send = true; + + // Don't send the notification to the default 'admin_email' value. + if ( 'you@example.com' === $old_email ) { + $send = false; + } + /** * Filters whether to send the site admin email change notification email. * @@ -6002,7 +6009,7 @@ function wp_site_admin_email_change_notification( $old_email, $new_email, $optio * @param string $old_email The old site admin email address. * @param string $new_email The new site admin email address. */ - $send = apply_filters( 'send_site_admin_email_change_email', true, $old_email, $new_email ); + $send = apply_filters( 'send_site_admin_email_change_email', $send, $old_email, $new_email ); if ( ! $send ) { return; diff --git a/src/wp-includes/ms-functions.php b/src/wp-includes/ms-functions.php index 984a69ce6f..c878739d6e 100644 --- a/src/wp-includes/ms-functions.php +++ b/src/wp-includes/ms-functions.php @@ -2842,6 +2842,13 @@ All at ###SITENAME### * @param int $network_id ID of the network. */ function wp_network_admin_email_change_notification( $option_name, $new_email, $old_email, $network_id ) { + $send = true; + + // Don't send the notification to the default 'admin_email' value. + if ( 'you@example.com' === $old_email ) { + $send = false; + } + /** * Filters whether to send the network admin email change notification email. * @@ -2852,7 +2859,7 @@ function wp_network_admin_email_change_notification( $option_name, $new_email, $ * @param string $new_email The new network admin email address. * @param int $network_id ID of the network. */ - $send = apply_filters( 'send_network_admin_email_change_email', true, $old_email, $new_email, $network_id ); + $send = apply_filters( 'send_network_admin_email_change_email', $send, $old_email, $new_email, $network_id ); if ( ! $send ) { return;