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.
Built from https://develop.svn.wordpress.org/trunk@51252


git-svn-id: http://core.svn.wordpress.org/trunk@50861 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Clorith 2021-06-28 23:07:57 +00:00
parent ccdb1766ae
commit 87a427d3f0
2 changed files with 6 additions and 4 deletions

View File

@ -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 )
);
}

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.8-beta4-51251';
$wp_version = '5.8-beta4-51252';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.