WordPress 5.2 was released yesterday and it introduced a new Site Health Tool in the admin to help site owners with common configuration issues that might cause problems for their site.
These tests were carefully selected based on the recommended configuration for the majority of site owners. However, there are certain situations where the default tests, or tests that have been added by a plugin, may not be relevant to your setup.
Some examples include:
- Disabling automatic updates because you keep your entire site under version control.
- Intentionally keeping one or more disabled plugins installed for temporary activation.
- Running PHP 7.2, which is secure and actively maintained, but your host hasn’t made PHP 7.3 available yet.
In these cases, it would be helpful to exclude those tests, but still allow the other tests to run so you’ll be aware of any issues with your site. This is especially helpful for people who have clients that might get concerned when viewing this page and seeing a “failing” test.
Note: I do not encourage you to disable tests unless you have a valid reason for doing so. If a tests shows a Critical Issue
or Recommended Improvement
, and you don’t understand why, I encourage you to ask for help on the support forums, or from your hosting provider.
Site Health Tool Manager Plugin
The easiest option is to use a plugin I made called Site Health Tool Manager. It adds a very basic settings screen that allows you to uncheck individual tests that you don’t want to run.
I have a couple more features I’d like to add to the plugin, such as limiting Site Health Tool access to only certain users, but it’s intentionally pretty simple.
The nice thing about this plugin method is that it will also identify any tests registered by other plugins and allow you to disable those as well.
Filtering the Tests Directly
If you’d prefer not to add the plugin—for example if you don’t want to allow the tests to be turned back on—you can do it directly using a tiny bit of code in an MU Plugin or in functions.php
in your theme.
This is done through the site_status_tests
filter, which is fired on the return from WP_Site_Health::get_tests()
.
Here is an example that removes the PHP version test:
function prefix_remove_php_test( $tests ) {
unset( $tests['direct']['php_version'] );
return $tests;
}
add_filter( 'site_status_tests', 'prefix_remove_php_test' );
Code language: PHP (php)
Note that $tests
is a multi-dimensional array. It consists of $tests['direct']
and $tests['async']
. The direct tests are run in PHP before the Site Health Status screen is loaded, and the async tests are fired via AJAX calls after the page loads.
You’ll need to check the response from WP_Site_Health::get_tests()
or view the function in /wp-admin/includes/class-wp-site-health.php
directly to figure out which group the test you want to remove resides in, and what its key is.
I’d love a plugin to completely disable Site Health.
Just released (June 10, 2019): https://wordpress.org/plugins/wp-disable-site-health/
Kudos to Louis Fico (plugin author)!
Just released. Try this plugin: https://wordpress.org/plugins/wp-disable-site-health/
Works like a charm. In lieu of this plugin, a PHP snippet can be added to your website using the code located in the plugin’s index.php file.
Hoping a future revision of WordPress will include an option to disable the Site Health tool.
This does not disable site health tests which are called via cron, it only hides the menu entry and redirects the site health screen.
This plugin does not hide any menu items or redirect at all. All of the code is visible in this file: https://github.com/earnjam/site-health-tool-manager/blob/master/site-health-tool-manager.php
Are you confusing it with a different plugin?
> WeServeAnswers, Jun 14, 2019 / 11:10 am
> Just released. Try this plugin: https://wordpress.org/plugins/wp-disable-site-health/
> Aviator, Jun 14, 2019 / 11:33 am
> Just released (June 10, 2019): https://wordpress.org/plugins/wp-disable-site-health/
This does not disable site health tests which are called via cron, it only hides the menu entry and redirects the site health screen.
Are you confusing replies to comments with comment to article?
Thank you, Mr. Earnhardt. I had pesky “critical” errors. No longer.
I inserted in my functions.php:
function prefix_remove_rest_availability( $tests ) {
unset( $tests['direct']['rest_availability'] );
return $tests;
}
add_filter( 'site_status_tests', 'prefix_remove_rest_availability' );
function prefix_remove_loopback_requests( $tests ) {
unset( $tests['async']['loopback_requests'] );
return $tests;
}
add_filter( 'site_status_tests', 'prefix_remove_loopback_requests' );
I’m back 🙂
Apologies, forgot to mention it last time. Great article, Mr. Earnhardt!
The noted snippet (code) has been extremely useful to us. We incorporated his snippet using the plugin, Code Snippets, a long time ago.
Since the release of WP 5.6.2, however, vast improvements have been made to WP’s Site Health Tool which has eliminated our need to use it. Have others experienced the same ?
Cheers!