Commit e8463f7be0 for wordpress.org

commit e8463f7be06fac9ff88b2846ceb4018337ade5d1
Author: afercia <afercia@git.wordpress.org>
Date:   Sun Sep 20 10:45:53 2026 +0000

    Administration: Improve the Search engine visibility setting accessibility.

    Conditionally associates the description of the Search engine visibility setting on the Reading Settings and Install pages:
    - When the setting shows two radio buttons, the description is associated to the wrapping fieldset element.
    - Otherwise, it is associated to the checkbox.

    Additionally:
    - Fixes an orphaned label element in the Install page.
    - Replaces implicit labeling (label elements that wrap inputs) with explicit labeling.

    Developed in https://github.com/WordPress/wordpress-develop/pull/12794

    Props sawf1y, abcd95, afercia, joedolson.
    Fixes #65766.

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


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

diff --git a/wp-admin/install.php b/wp-admin/install.php
index 977e231ccc..3d5a142b48 100644
--- a/wp-admin/install.php
+++ b/wp-admin/install.php
@@ -114,20 +114,19 @@ function display_setup_form( $error = null ) {
 			<td><input name="weblog_title" type="text" id="weblog_title" size="25" value="<?php echo esc_attr( $weblog_title ); ?>" /></td>
 		</tr>
 		<tr>
-			<th scope="row"><label for="user_login"><?php _e( 'Username' ); ?></label></th>
-			<td>
-			<?php
-			if ( $user_table ) {
-				_e( 'User(s) already exists.' );
-				echo '<input name="user_name" type="hidden" value="admin" />';
-			} else {
-				?>
-				<input name="user_name" type="text" id="user_login" size="25" aria-describedby="user-name-desc" value="<?php echo esc_attr( sanitize_user( $user_name, true ) ); ?>" />
-				<p id="user-name-desc"><?php _e( 'Usernames can have only alphanumeric characters, spaces, underscores, hyphens, periods, and the @ symbol.' ); ?></p>
-				<?php
-			}
-			?>
-			</td>
+			<?php if ( $user_table ) : ?>
+				<th scope="row"><?php _e( 'Username' ); ?></th>
+				<td>
+					<?php _e( 'User(s) already exists.' ); ?>
+					<input name="user_name" type="hidden" value="admin" />
+				</td>
+			<?php else : ?>
+				<th scope="row"><label for="user_login"><?php _e( 'Username' ); ?></label></th>
+				<td>
+					<input name="user_name" type="text" id="user_login" size="25" aria-describedby="user-name-desc" value="<?php echo esc_attr( sanitize_user( $user_name, true ) ); ?>" />
+					<p id="user-name-desc"><?php _e( 'Usernames can have only alphanumeric characters, spaces, underscores, hyphens, periods, and the @ symbol.' ); ?></p>
+				</td>
+			<?php endif; ?>
 		</tr>
 		<?php if ( ! $user_table ) : ?>
 		<tr class="form-field form-required user-pass1-wrap">
@@ -179,28 +178,32 @@ function display_setup_form( $error = null ) {
 			<td><input name="admin_email" type="email" id="admin_email" size="25" aria-describedby="admin-email-desc" value="<?php echo esc_attr( $admin_email ); ?>" />
 			<p id="admin-email-desc"><?php _e( 'Double-check your email address before continuing.' ); ?></p></td>
 		</tr>
-		<?php $blog_privacy_selector_title = has_action( 'blog_privacy_selector' ) ? __( 'Site visibility' ) : __( 'Search engine visibility' ); ?>
+		<?php
+			$has_action_blog_privacy_selector = has_action( 'blog_privacy_selector' );
+			$blog_privacy_selector_title      = $has_action_blog_privacy_selector ? __( 'Site visibility' ) : __( 'Search engine visibility' );
+			$fieldset_aria_describedby        = $has_action_blog_privacy_selector ? ' aria-describedby="options-site-visibility-description"' : '';
+		?>
 		<tr>
-			<th scope="row"><?php echo $blog_privacy_selector_title; ?></th>
+			<th scope="row"><?php echo esc_html( $blog_privacy_selector_title ); ?></th>
 			<td>
-				<fieldset>
-					<legend class="screen-reader-text"><span><?php echo $blog_privacy_selector_title; ?></span></legend>
+				<fieldset<?php echo $fieldset_aria_describedby; ?>>
+					<legend class="screen-reader-text"><?php echo esc_html( $blog_privacy_selector_title ); ?></legend>
 					<?php
-					if ( has_action( 'blog_privacy_selector' ) ) {
+					if ( $has_action_blog_privacy_selector ) {
 						?>
 						<input id="blog-public" type="radio" name="blog_public" value="1" <?php checked( 1, $blog_public ); ?> />
 						<label for="blog-public"><?php _e( 'Allow search engines to index this site' ); ?></label><br />
-						<input id="blog-norobots" type="radio" name="blog_public"  aria-describedby="public-desc" value="0" <?php checked( 0, $blog_public ); ?> />
+						<input id="blog-norobots" type="radio" name="blog_public" value="0" <?php checked( 0, $blog_public ); ?> />
 						<label for="blog-norobots"><?php _e( 'Discourage search engines from indexing this site' ); ?></label>
-						<p id="public-desc" class="description"><?php _e( 'Note: Discouraging search engines does not block access to your site &mdash; it is up to search engines to honor your request.' ); ?></p>
+						<p id="options-site-visibility-description" class="description"><?php _e( 'Note: Discouraging search engines does not block access to your site &mdash; it is up to search engines to honor your request.' ); ?></p>
 						<?php
 						/** This action is documented in wp-admin/options-reading.php */
 						do_action( 'blog_privacy_selector' );
 					} else {
 						?>
-						<label for="blog_public"><input name="blog_public" type="checkbox" id="blog_public" aria-describedby="privacy-desc" value="0" <?php checked( 0, $blog_public ); ?> />
-						<?php _e( 'Discourage search engines from indexing this site' ); ?></label>
-						<p id="privacy-desc" class="description"><?php _e( 'It is up to search engines to honor this request.' ); ?></p>
+						<input name="blog_public" type="checkbox" id="blog_public" aria-describedby="options-site-visibility-description" value="0" <?php checked( 0, $blog_public ); ?> />
+						<label for="blog_public"><?php _e( 'Discourage search engines from indexing this site' ); ?></label>
+						<p id="options-site-visibility-description" class="description"><?php _e( 'It is up to search engines to honor this request.' ); ?></p>
 					<?php } ?>
 				</fieldset>
 			</td>
diff --git a/wp-admin/options-reading.php b/wp-admin/options-reading.php
index d52d51bbe3..eb8fb72b3a 100644
--- a/wp-admin/options-reading.php
+++ b/wp-admin/options-reading.php
@@ -16,6 +16,8 @@ if ( ! current_user_can( 'manage_options' ) ) {
 // Used in the HTML title tag.
 $title       = __( 'Reading Settings' );
 $parent_file = 'options-general.php';
+// Check whether the blog_privacy_selector action is in use, for later reuse.
+$has_action_blog_privacy_selector = has_action( 'blog_privacy_selector' );

 add_action( 'admin_head', 'options_reading_add_js' );

@@ -41,7 +43,7 @@ get_current_screen()->add_help_tab(
 get_current_screen()->add_help_tab(
 	array(
 		'id'      => 'site-visibility',
-		'title'   => has_action( 'blog_privacy_selector' ) ? __( 'Site visibility' ) : __( 'Search engine visibility' ),
+		'title'   => $has_action_blog_privacy_selector ? __( 'Site visibility' ) : __( 'Search engine visibility' ),
 		'content' => '<p>' . __( 'You can choose whether or not your site will be crawled by robots, ping services, and spiders. If you want those services to ignore your site, click the checkbox next to &#8220;Discourage search engines from indexing this site&#8221; and click the Save Changes button at the bottom of the screen.' ) . '</p>' .
 			'<p>' . __( 'Note that even when set to discourage search engines, your site is still visible on the web and not all search engines adhere to this directive.' ) . '</p>' .
 			'<p>' . __( 'When this setting is in effect, a reminder is shown in the At a Glance box of the Dashboard that says, &#8220;Search engines discouraged&#8221;, to remind you that you have directed search engines to not crawl your site.' ) . '</p>',
@@ -206,17 +208,20 @@ else :
 </fieldset></td>
 </tr>

-<?php $blog_privacy_selector_title = has_action( 'blog_privacy_selector' ) ? __( 'Site visibility' ) : __( 'Search engine visibility' ); ?>
+<?php
+$blog_privacy_selector_title = $has_action_blog_privacy_selector ? __( 'Site visibility' ) : __( 'Search engine visibility' );
+$fieldset_aria_describedby   = $has_action_blog_privacy_selector ? ' aria-describedby="option-site-visibility-description"' : '';
+?>
 <tr class="option-site-visibility">
 <th scope="row"><?php echo $blog_privacy_selector_title; ?> </th>
-<td><fieldset>
+<td><fieldset<?php echo $fieldset_aria_describedby; ?>>
 	<legend class="screen-reader-text"><span><?php echo $blog_privacy_selector_title; ?></span></legend>
-<?php if ( has_action( 'blog_privacy_selector' ) ) : ?>
+<?php if ( $has_action_blog_privacy_selector ) : ?>
 	<input id="blog-public" type="radio" name="blog_public" value="1" <?php checked( '1', get_option( 'blog_public' ) ); ?> />
 	<label for="blog-public"><?php _e( 'Allow search engines to index this site' ); ?></label><br />
 	<input id="blog-norobots" type="radio" name="blog_public" value="0" <?php checked( '0', get_option( 'blog_public' ) ); ?> />
 	<label for="blog-norobots"><?php _e( 'Discourage search engines from indexing this site' ); ?></label>
-	<p class="description"><?php _e( 'Note: Neither of these options blocks access to your site &mdash; it is up to search engines to honor your request.' ); ?></p>
+	<p id="option-site-visibility-description" class="description"><?php _e( 'Note: Neither of these options blocks access to your site &mdash; it is up to search engines to honor your request.' ); ?></p>
 	<?php
 	/**
 	 * Enables the legacy 'Site visibility' privacy options.
@@ -235,9 +240,9 @@ else :
 	do_action( 'blog_privacy_selector' );
 	?>
 <?php else : ?>
-	<label for="blog_public"><input name="blog_public" type="checkbox" id="blog_public" value="0" <?php checked( '0', get_option( 'blog_public' ) ); ?> />
-	<?php _e( 'Discourage search engines from indexing this site' ); ?></label>
-	<p class="description"><?php _e( 'It is up to search engines to honor this request.' ); ?></p>
+	<input name="blog_public" type="checkbox" id="blog_public" aria-describedby="option-site-visibility" value="0" <?php checked( '0', get_option( 'blog_public' ) ); ?> />
+	<label for="blog_public"><?php _e( 'Discourage search engines from indexing this site' ); ?></label>
+	<p id="option-site-visibility-description" class="description"><?php _e( 'It is up to search engines to honor this request.' ); ?></p>
 <?php endif; ?>
 </fieldset></td>
 </tr>
diff --git a/wp-includes/version.php b/wp-includes/version.php
index 27b6e60dff..999a15bb9c 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
  *
  * @global string $wp_version
  */
-$wp_version = '7.2-alpha-63761';
+$wp_version = '7.2-alpha-63762';

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