From b1a6608c61e6d80bd738578cb4502a34139dd2cf Mon Sep 17 00:00:00 2001 From: "Marius L. J" Date: Mon, 28 Jun 2021 23:06:31 +0000 Subject: [PATCH] Site Health: Improve readability of site titles. This splits up the site title for the Site Health tabs to make it more obvious what page a user is viewing, and which tab under that page. It also removes a possible source of warnings if a user tries accessing a tab that does not exist. The introduction of this check for existing tabs also improves the accuracy of the active-tab indicator, ensuring the indicator shows up for the default tab, when no other tab has been selected. Follow-up to [50764]. Props audrasjb, swissspidy. Fixes #53535. git-svn-id: https://develop.svn.wordpress.org/trunk@51252 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/site-health.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/wp-admin/site-health.php b/src/wp-admin/site-health.php index 590153a102..9facc1f936 100644 --- a/src/wp-admin/site-health.php +++ b/src/wp-admin/site-health.php @@ -36,10 +36,12 @@ $wrapper_classes = array( 'tab-count-' . count( $tabs ), ); +$current_tab = ( isset( $_GET['tab'] ) ? $_GET['tab'] : '' ); + $title = sprintf( // translators: %s: The currently displayed tab. - __( 'Site Health %s' ), - ( isset( $_GET['tab'] ) ? esc_html( $tabs[ $_GET['tab'] ] ) : esc_html( reset( $tabs ) ) ) + __( 'Site Health - %s' ), + ( isset( $tabs[ $current_tab ] ) ? esc_html( $tabs[ $current_tab ] ) : esc_html( reset( $tabs ) ) ) ); if ( ! current_user_can( 'view_site_health_checks' ) ) { @@ -133,7 +135,7 @@ require_once ABSPATH . 'wp-admin/admin-header.php'; admin_url( 'site-health.php' ) ) ), - ( isset( $_GET['tab'] ) && $_GET['tab'] === $slug ? 'active' : '' ), + ( $current_tab === $slug ? 'active' : '' ), esc_html( $label ) ); }