apply_filters( 'site_status_tests', array $test_type )

Add or modify which site status tests are run on a site.

Description Description

The site health is determined by a set of tests based on best practices from both the WordPress Hosting Team, but also web standards in general.

Some sites may not have the same requirements, for example the automatic update checks may be handled by a host, and are therefore disabled in core. Or maybe you want to introduce a new test, is caching enabled/disabled/stale for example.

Tests may be added either as direct, or asynchronous ones. Any test that may require some time to complete should run asynchronously, to avoid extended loading periods within wp-admin.

Top ↑

Parameters Parameters


(array) An associative array, where the $test_type is either direct or async, to declare if the test should run via Ajax calls after page load.

  • 'identifier'
    (array) $identifier should be a unique identifier for the test that should run. Plugins and themes are encouraged to prefix test identifiers with their slug to avoid any collisions between tests.
    • 'label'
      (string) A friendly label for your test to identify it by.
    • 'test'
      (mixed) A callable to perform a direct test, or a string AJAX action to be called to perform an async test.
    • 'has_rest'
      (boolean) Optional. Denote if $test has a REST API endpoint.
    • 'skip_cron'
      (boolean) Whether to skip this test when running as cron.
    • 'async_direct_test'
      (callable) A manner of directly calling the test marked as asynchronous, as the scheduled event can not authenticate, and endpoints may require authentication.

Top ↑

Source Source

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

View on Trac

Top ↑

Changelog Changelog

Version Description
5.6.0 Added the async_direct_test array key. Added the skip_cron array key.
5.2.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

  1. Skip to note 1 content
    Contributed by Rami Yushuvaev

    Example usage to remove a test:

    function remove_background_updates_test( $tests ) {
    	unset( $tests['async']['background_updates'] );
    	return $tests;
    add_filter( 'site_status_tests', 'remove_background_updates_test' );

    Also check out the Site Health Manager plugin that allows you to easily remove custom status test using this hook.

  2. Skip to note 2 content
    Contributed by joelhardi

    Here’s a quick one-liner to disable 3 Site Health tests that tend to be false alarms. You can drop it into a plugin or your theme’s functions.php.

    • PHP version (which is outside of user control anyway)
    • theme version (complains when it doesn’t find one of the WordPress twenty**** themes)
    • background updates (complains when you have a .git directory in your site root, for example)
    add_filter('site_status_tests', function (array $test_type) {
      return $test_type;
    }, 10, 1);

Top ↑

You must log in before being able to contribute a note or feedback.