Commit 0acc8fdb04 for wordpress.org

commit 0acc8fdb04a280b645f198a368ce686a890a18fa
Author: lancewillett <lancewillett@git.wordpress.org>
Date:   Tue Nov 3 17:17:03 2026 +0000

    Networks and Sites: Clarify the network admin email change notices.

    Bring the network admin email change flow in line with the single site notices. Show a pending change as an info notice at the top of Network Settings and next to the email field, both with a "Cancel request" link. After the confirmation link is followed, show "Network admin email updated." instead of "Settings saved."

    Show "Settings saved." only when `updated=true`, and in bold, so a failed confirmation or a canceled request no longer reports a save. Add `network_admin_email_updated` to `wp_removable_query_args()`.

    Developed in: https://github.com/WordPress/wordpress-develop/pull/14247, https://github.com/WordPress/wordpress-develop/pull/14466

    Props therssoftware, afercia, johnjamesjacoby, realloc.
    Fixes #66300.

    Built from https://develop.svn.wordpress.org/trunk@65240


    git-svn-id: http://core.svn.wordpress.org/trunk@64389 1a063a9b-81f0-0310-95a4-ce76da25c4cd

diff --git a/wp-admin/network/settings.php b/wp-admin/network/settings.php
index 1e13084a85..e8ec03944c 100644
--- a/wp-admin/network/settings.php
+++ b/wp-admin/network/settings.php
@@ -24,12 +24,18 @@ $parent_file = 'settings.php';
 // Handle network admin email change requests.
 if ( ! empty( $_GET['network_admin_hash'] ) ) {
 	$new_admin_details = get_site_option( 'network_admin_hash' );
-	$redirect          = 'settings.php?updated=false';
+	$redirect          = add_query_arg( array( 'updated' => 'false' ), 'settings.php' );
 	if ( is_array( $new_admin_details ) && hash_equals( $new_admin_details['hash'], $_GET['network_admin_hash'] ) && ! empty( $new_admin_details['newemail'] ) ) {
 		update_site_option( 'admin_email', $new_admin_details['newemail'] );
 		delete_site_option( 'network_admin_hash' );
 		delete_site_option( 'new_admin_email' );
-		$redirect = 'settings.php?updated=true';
+		$redirect = add_query_arg(
+			array(
+				'updated'                     => 'true',
+				'network_admin_email_updated' => 'true',
+			),
+			'settings.php'
+		);
 	}
 	wp_redirect( network_admin_url( $redirect ) );
 	exit;
@@ -37,7 +43,7 @@ if ( ! empty( $_GET['network_admin_hash'] ) ) {
 	check_admin_referer( 'dismiss_new_network_admin_email' );
 	delete_site_option( 'network_admin_hash' );
 	delete_site_option( 'new_admin_email' );
-	wp_redirect( network_admin_url( 'settings.php?updated=true' ) );
+	wp_redirect( network_admin_url( 'settings.php' ) );
 	exit;
 }

@@ -137,9 +143,9 @@ if ( $_POST ) {

 require_once ABSPATH . 'wp-admin/admin-header.php';

-if ( isset( $_GET['updated'] ) ) {
+if ( isset( $_GET['updated'] ) && 'true' === $_GET['updated'] && ! isset( $_GET['network_admin_email_updated'] ) ) {
 	wp_admin_notice(
-		__( 'Settings saved.' ),
+		'<strong>' . __( 'Settings saved.' ) . '</strong>',
 		array(
 			'type'        => 'success',
 			'dismissible' => true,
@@ -147,10 +153,41 @@ if ( isset( $_GET['updated'] ) ) {
 		)
 	);
 }
+
+$new_network_admin_email         = get_site_option( 'new_admin_email' );
+$pending_new_network_admin_email = $new_network_admin_email && get_site_option( 'admin_email' ) !== $new_network_admin_email;
 ?>

 <div class="wrap">
 	<h1><?php echo esc_html( $title ); ?></h1>
+	<?php
+	if ( isset( $_GET['network_admin_email_updated'] ) ) {
+		$message = '<strong>' . __( 'Network admin email updated.' ) . '</strong>';
+		wp_admin_notice(
+			$message,
+			array(
+				'dismissible' => true,
+				'type'        => 'success',
+			)
+		);
+	}
+
+	$pending_network_admin_email_cancel_request_link = sprintf(
+		' <a href="%1$s">%2$s</a>',
+		esc_url( wp_nonce_url( network_admin_url( 'settings.php?dismiss=new_network_admin_email' ), 'dismiss_new_network_admin_email' ) ),
+		_x( 'Cancel request', 'admin email change' )
+	);
+
+	if ( $pending_new_network_admin_email ) {
+		$message = sprintf(
+			/* translators: %s: New network admin email address. */
+			__( 'The network admin email address has not been updated yet. Please check the inbox at %s for a confirmation email.' ),
+			'<code>' . esc_html( $new_network_admin_email ) . '</code>'
+		);
+		$message .= $pending_network_admin_email_cancel_request_link;
+		wp_admin_notice( $message, array( 'type' => 'info' ) );
+	}
+	?>
 	<form method="post" action="settings.php" novalidate="novalidate">
 		<?php wp_nonce_field( 'siteoptions' ); ?>
 		<h2 id="wp-settings-section-operational-settings"><?php _e( 'Operational Settings' ); ?></h2>
@@ -170,24 +207,19 @@ if ( isset( $_GET['updated'] ) ) {
 						<?php _e( 'This address is used for admin purposes. If you change this, an email will be sent to your new address to confirm it. <strong>The new address will not become active until confirmed.</strong>' ); ?>
 					</p>
 					<?php
-					$new_admin_email = get_site_option( 'new_admin_email' );
-					if ( $new_admin_email && get_site_option( 'admin_email' ) !== $new_admin_email ) :
+					if ( $pending_new_network_admin_email ) :
 						$notice_message = sprintf(
-							/* translators: %s: New network admin email. */
+							/* translators: %s: New network admin email address. */
 							__( 'There is a pending change of the network admin email to %s.' ),
-							'<code>' . esc_html( $new_admin_email ) . '</code>'
+							'<code>' . esc_html( $new_network_admin_email ) . '</code>'
 						);

-						$notice_message .= sprintf(
-							' <a href="%1$s">%2$s</a>',
-							esc_url( wp_nonce_url( network_admin_url( 'settings.php?dismiss=new_network_admin_email' ), 'dismiss_new_network_admin_email' ) ),
-							__( 'Cancel' )
-						);
+						$notice_message .= $pending_network_admin_email_cancel_request_link;

 						wp_admin_notice(
 							$notice_message,
 							array(
-								'type'               => 'warning',
+								'type'               => 'info',
 								'dismissible'        => true,
 								'additional_classes' => array( 'inline' ),
 							)
diff --git a/wp-includes/functions.php b/wp-includes/functions.php
index f7baf953bc..f215d81f73 100644
--- a/wp-includes/functions.php
+++ b/wp-includes/functions.php
@@ -1282,6 +1282,7 @@ function wp_removable_query_args() {
 		'ids',
 		'locked',
 		'message',
+		'network_admin_email_updated',
 		'same',
 		'saved',
 		'settings-updated',
diff --git a/wp-includes/version.php b/wp-includes/version.php
index a7f6dd66d9..a55ab1073c 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
  *
  * @global string $wp_version
  */
-$wp_version = '7.2-beta4-65239';
+$wp_version = '7.2-beta4-65240';

 /**
  * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.