Site Health: Correct array key for the default tab

Use `reset` to get the label from the first tab entry as the default if no tab is defined.
This ensures even if the tab order is changed, or tabs are removed, no warnings will be thrown.

Follow-up to [50764].

See #47225.

git-svn-id: https://develop.svn.wordpress.org/trunk@50765 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Marius L. J
2021-04-17 10:53:04 +00:00
parent a32a192ede
commit 05b44492c8

View File

@@ -39,7 +39,7 @@ $wrapper_classes = array(
$title = sprintf(
// translators: %s: The currently displayed tab.
__( 'Site Health %s' ),
( isset( $_GET['tab'] ) ? esc_html( $tabs[ $_GET['tab'] ] ) : esc_html( $tabs[0] ) )
( isset( $_GET['tab'] ) ? esc_html( $tabs[ $_GET['tab'] ] ) : esc_html( reset( $tabs ) ) )
);
if ( ! current_user_can( 'view_site_health_checks' ) ) {