What’s new in Site Health for WordPress 5.3

The Site Health component of WordPress covers both the new self-service area under Tools > Site Health, and the error protection which provides means to access a site while it is experiencing technical difficulties.

For WordPress 5.3, a handful of enhancements have been made to both these parts of the component, as well as multiple minor improvements to provide the best possible experience. Let’s cover the more notable changes and features that are now available.

Changes to the grading indicator

Following ticketticket Created for both bug reports and feature development on the bug tracker. #47046, modifications have been made to the site grading shown when Site Health Checks are run.

The modified Site Health headerHeader The header of your site is typically the first thing people will experience. The masthead or header art located across the top of your page is part of the look and feel of your website. It can influence a visitor’s opinion about your content and you/ your organization’s brand. It may also look different on different screen sizes. with the new grading indicator

The previous iteration included only an indicator and a percentage. This was meant to indicate how many tests were passing, not how perfect a site was. There was also no clear indication that the Site Health checks had not yet completed. The grading circle would pulse, but this was not obvious, nor was a good solution for those who may have a difficulty discerning this subtle change.

To address this, the numbers were removed in favor of two simple states: Should be improved, and Good. As for the indicator while work is being done, the pulsing animation is still there, but the status is shown as Results are still loading… to better relay what is happening on the page.

Observations of how developers extended the page also lead to changes in how the grading is weighted. This means that the existence of a critical issue will always lead to a recommendation of needing improvements. To offset the amount of checks some may add, the recommended results now carry less weight, making them have a lower impact on the overall outcome.

The indicator itself was kept as it is a visual nudge for many users, with the removal of the percentage it no longer has the same negative association, and now serves more as a reminder that work can be done, but the text associated with it lets the user know that it also doesn’t need to happen right this instance, hopefully leading to less mental anguish.

Recovery email enhancements

If a site failure occurs, an attempt to send a recovery email is made, although already a useful tool, if problems persisted, or you as a user had a hard time understanding what was happening, it might be difficult to get help.

To address this, the recovery email now also includes the bare essentials that is useful for debugging a problem if reaching out to any kind of support, added in ticket #48090.

The debug information provided can be modified using the new recovery_email_debug_info filterFilter Filters are one of the two types of Hooks https://codex.wordpress.org/Plugin_API/Hooks. They provide a way for functions to modify data of other functions. They are the counterpart to Actions. Unlike Actions, filters are meant to work in an isolated manner, and should never have side effects such as affecting global variables and output., the information is provided as an associated array, and by default contains the following information:

  • WordPress version
  • PHPPHP The web scripting language in which WordPress is primarily architected. WordPress requires PHP 7.4 or higher version
  • Current theme and version
  • If a pluginPlugin A plugin is a piece of software containing a group of functions that can be added to a WordPress website. They can extend functionality or add new features to your WordPress websites. WordPress plugins are written in the PHP programming language and integrate seamlessly with WordPress. These can be free in the WordPress.org Plugin Directory https://wordpress.org/plugins/ or can be cost-based plugin from a third-party caused the issue: The plugin name and version

A quick example of extending this would be a host wanting to declare which server the error occurred on, in the event that it’s an extension causing issues:

<?php
add_filter( 'recovery_email_debug_info', 'myhost_debug_node_name' );
function myhost_debug_node_name( $debug_array ) {
	$debug_array['node_name'] => 'Node: host01-rack03-box11';
	
	return $debug_array;
}

Filters for completed Site Health status tests

When a Site Health test has completed, it is now exposed to the new site_status_test_result filter, introduced with ticket #47864.

This is a particularly interesting filter, as it exists both in PHP, for direct tests, and as an identical JavaScriptJavaScript JavaScript or JS is an object-oriented computer programming language commonly used to create interactive effects within web browsers. WordPress makes extensive use of JS for a better user experience. While PHP is executed on the server, JS executes within a user’s browser. https://www.javascript.com/. implementation for the asynchronous ones.

In keeping with the host-related examples, consider a site checking for HTTPSHTTPS HTTPS is an acronym for Hyper Text Transfer Protocol Secure. HTTPS is the secure version of HTTP, the protocol over which data is sent between your browser and the website that you are connected to. The 'S' at the end of HTTPS stands for 'Secure'. It means all communications between your browser and the website are encrypted. This is especially helpful for protecting sensitive data like banking information., if it isn’t set up, the host can add an action link to their control panel for enabling the feature:

<?php
add_filter( 'site_status_test_result', 'myhost_site_health_https_link' );
function myhost_site_health_https_link( $site_health_check ) {
	// If the filtered test is not the `https_status` one, return the original result.
	if ( 'https_status' !== $site_health_check['test'] ) {
		return $site_health_check;
	}

	// Only add our action if the check did not pass.
	if ( 'good' !== $site_health_check['status'] ) {
		$site_health_check['actions'] .= sprintf(
			'<a href="%s">%s</a>',
			esc_attr( 'https://panel.myhost.test' ),
			__( 'Enable HTTPs in MyHost Control Panel', 'myhost' )
		);
	}

	return $site_health_check;
}

For a full list of changes to the Site Health component in WordPress 5.3, check the full list on trac.

#5-3, #dev-notes