Make WordPress Core

Opened 4 years ago

Last modified 4 years ago

#52343 new defect (bug)

Site Health Page: Inactive theme message is inconsistent

Reported by: subrataemfluence's profile subrataemfluence Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 5.6
Component: Site Health Keywords: 2nd-opinion
Focuses: administration Cc:

Description

On the Site Health page, the Theme related messages are confusing. The way theme name is written in different areas is not consistent as well.

File: /wp-admin/includes/class-wp-site-health.php

Scenario 1 (More than 2 themes available including Twenty Twenty-One):
Message:


Your site has 1 inactive theme, other than Twenty Twenty-One, the default WordPress theme, and Yardrive, your active theme. We recommend removing any unused themes to enhance your site’s security.


From the above message, it is clear that WordPress recommends removing all themes that unused. If someone removes all except the active one, Site Health then says:
Your site does not have any default theme.

This is confusing. The initial message should be more self-explanatory, something like:

Your site has 1 inactive theme, other than Twenty Twenty-One, the default WordPress theme, and Yardrive, your active theme. We recommend keeping at least one theme to be used as the default along with the active theme and remove the rest to enhance your site's security. Default themes are used by WordPress automatically if anything is wrong with your chosen theme.

Scenario 2: (2 themes without any bundled theme)
Message:


Your site has 1 inactive theme, other than twentytwentyone, the default WordPress theme, and Yardrive, your active theme. We recommend removing any unused themes to enhance your site's security.


Again, this is confusing. It says "other than twentytwentyone", when I do not have that theme installed at all!
Also, look at how the theme name is written in different cases.
In the first case, it says Twenty Twenty-One, and for the second one, it becomes twentytwentyone. They should be consistent.

If there is no twentytwentyone, either remove it from the message or include the exact theme name that is installed instead of twentytwentyone.

Twenty Twenty-One is the default theme with WordPress 5.6, which is fine, but at the same time, the theme name should be used in such a way that it does not create any confusion in users' minds. Please note, I am talking about WordPress users, not developers.

If someone has any bundled theme like twenty19 or twenty17 installed other than twenty21 as the default theme, either it should not complain about twenty21 or this should be made clear so that general WordPress users know that twenty21 is the default theme for WordPress 5.6 and is recommended to be there as the default theme.

If the above makes sense, I would be happy to go ahead and try to build a patch for this.

Regards

Change History (3)

#1 @SergeyBiryukov
4 years ago

Thanks for the ticket! Just noting that there was also some discussion about this on #50118.

Some other related tickets: #46900, #49056, #51830,

This ticket was mentioned in Slack in #forums by joyously. View the logs.


4 years ago

#3 @joyously
4 years ago

The way that the check for the default theme is done needs to change.
Currently, it is using the WP_DEFAULT_THEME constant as the theme to find. But core uses that constant as the starting place to find the default theme:

// If WP_DEFAULT_THEME doesn't exist, fall back to the latest core default theme.	
$default_theme = wp_get_theme( WP_DEFAULT_THEME );
if ( ! $default_theme->exists() ) {
	$default_theme = WP_Theme::get_core_default_theme();
}


So Site Health needs to call WP_Theme::get_core_default_theme() instead of simply checking the constant.

Note: See TracTickets for help on using tickets.