Make WordPress Core

Changeset 51252


Ignore:
Timestamp:
06/28/2021 11:06:31 PM (3 years ago)
Author:
Clorith
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/site-health.php

    r50766 r51252  
    3737);
    3838
     39$current_tab = ( isset( $_GET['tab'] ) ? $_GET['tab'] : '' );
     40
    3941$title = sprintf(
    4042    // translators: %s: The currently displayed tab.
    41     __( 'Site Health %s' ),
    42     ( isset( $_GET['tab'] ) ? esc_html( $tabs[ $_GET['tab'] ] ) : esc_html( reset( $tabs ) ) )
     43    __( 'Site Health - %s' ),
     44    ( isset( $tabs[ $current_tab ] ) ? esc_html( $tabs[ $current_tab ] ) : esc_html( reset( $tabs ) ) )
    4345);
    4446
     
    134136                    )
    135137                ),
    136                 ( isset( $_GET['tab'] ) && $_GET['tab'] === $slug ? 'active' : '' ),
     138                ( $current_tab === $slug ? 'active' : '' ),
    137139                esc_html( $label )
    138140            );
Note: See TracChangeset for help on using the changeset viewer.