Commit 8588e2eecd for wordpress.org
commit 8588e2eecd9a55754ba22388d5a8c4e57e658287
Author: afercia <afercia@git.wordpress.org>
Date: Thu Oct 8 09:32:57 2026 +0000
Users: Prevent duplicate email change admin notices on multisite.
Follow-up to [64228].
- Remove duplicate admin notices hooked from `ms-admin-filters.php`.
- Update `@since` tag for the `new_user_email_admin_notice()` docblock.
- Add unit tests for `new_user_email_admin_notice()`.
Developed in https://github.com/WordPress/wordpress-develop/pull/14086
Props ravipatel.
Fixes #66173.
Built from https://develop.svn.wordpress.org/trunk@64239
git-svn-id: http://core.svn.wordpress.org/trunk@63390 1a063a9b-81f0-0310-95a4-ce76da25c4cd
diff --git a/wp-admin/includes/ms-admin-filters.php b/wp-admin/includes/ms-admin-filters.php
index b1d73825f1..003b727e45 100644
--- a/wp-admin/includes/ms-admin-filters.php
+++ b/wp-admin/includes/ms-admin-filters.php
@@ -11,9 +11,6 @@
add_filter( 'wp_handle_upload_prefilter', 'check_upload_size' );
// User hooks.
-add_action( 'user_admin_notices', 'new_user_email_admin_notice' );
-add_action( 'network_admin_notices', 'new_user_email_admin_notice' );
-
add_action( 'admin_page_access_denied', '_access_denied_splash', 99 );
// Site hooks.
diff --git a/wp-includes/user.php b/wp-includes/user.php
index 1d0523cfc9..30c418ee26 100644
--- a/wp-includes/user.php
+++ b/wp-includes/user.php
@@ -4011,6 +4011,10 @@ All at ###SITENAME###
*
* @since 3.0.0
* @since 4.9.0 This function was moved from wp-admin/includes/ms.php so it's no longer Multisite specific.
+ * @since 7.2.0 The notice is displayed whenever an email change is pending, not only after updating
+ * the profile, and includes a link to cancel the request. The function is no longer
+ * hooked to the `admin_notices`, `user_admin_notices`, and `network_admin_notices`
+ * actions, and is instead called directly from wp-admin/user-edit.php.
*
* @global string $pagenow The filename of the current screen.
*/
@@ -4029,7 +4033,7 @@ function new_user_email_admin_notice() {
$message .= sprintf(
' <a href="%1$s">%2$s</a>',
esc_url( wp_nonce_url( self_admin_url( 'profile.php?dismiss=' . $current_user_id . '_new_email' ), 'dismiss-' . $current_user_id . '_new_email' ) ),
- _x( 'Cancel request', 'user email change' ),
+ _x( 'Cancel request', 'user email change' )
);
wp_admin_notice( $message, array( 'type' => 'info' ) );
}
diff --git a/wp-includes/version.php b/wp-includes/version.php
index 359e131acc..d867ab9b36 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
-$wp_version = '7.2-alpha-64238';
+$wp_version = '7.2-alpha-64239';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.