WordPress WP_Site_Health and list of Methods

WordPress 5.2 has introduced a new Site Health Tool in the admin to help site owners with common configuration issues that might cause problems for their site.

WP_Site_Health Class for looking up a site’s health based on a user’s WordPress environment. You can find the WP_Site_Health class inside this file: wp-admin/includes/class-wp-site-health.php

Available Methods in WP_Site_Health

Below are the list of available functions in WP_Site_Health:

  • __construct — WP_Site_Health constructor.
  • admin_body_class — Add a class to the body HTML tag.
  • can_perform_loopback — Run a loopback test on our site.
  • check_wp_version_check_exists — Test if wp_version_check is blocked.
  • enqueue_scripts — Enqueues the site health scripts.
  • get_cron_tasks — Populate our list of cron events and store them to a class-wide variable.
  • get_test_background_updates — Test if WordPress can run automated background updates.
  • get_test_dotorg_communication — Test if the site can communicate with WordPress.org.
  • get_test_http_requests — Test if HTTP requests are blocked.
  • get_test_https_status — Test if your site is serving content over HTTPS.
  • get_test_is_in_debug_mode — Test if debug information is enabled.
  • get_test_loopback_requests — Test if loopbacks work as expected.
  • get_test_php_extensions — Test if required PHP modules are installed on the host.
  • get_test_php_version — Test if the supplied PHP version is supported.
  • get_test_plugin_version — Test if plugins are outdated, or unnecessary.
  • get_test_rest_availability — Test if the REST API is accessible.
  • get_test_scheduled_events — Test if scheduled events run as intended.
  • get_test_sql_server — Test if the SQL server is up to date.
  • get_test_ssl_support — Check if the HTTP API can handle SSL/TLS requests.
  • get_test_theme_version — Test if themes are outdated, or unnecessary.
  • get_test_utf8mb4_support — Test if the database server is capable of using utf8mb4.
  • get_test_wordpress_version — Tests for WordPress version and outputs it.
  • get_tests — Return a set of tests that belong to the site status page.
  • has_late_cron — Check if any scheduled tasks are late.
  • has_missed_cron — Check if any scheduled tasks have been missed.
  • prepare_sql_data — Run the SQL version checks.
  • test_php_extension_availability — Check if the passed extension or function are available.
  • wp_schedule_test_init — Initiate the WP_Cron schedule test cases.

If you like FreeWebMentor and you would like to contribute, you can write an article and mail your article to [email protected] Your article will appear on the FreeWebMentor main page and help other developers.

Recommended Posts: