diff --git a/src/wp-admin/includes/class-wp-site-health.php b/src/wp-admin/includes/class-wp-site-health.php index 81908008d3..b6a4a678f3 100644 --- a/src/wp-admin/includes/class-wp-site-health.php +++ b/src/wp-admin/includes/class-wp-site-health.php @@ -2310,6 +2310,11 @@ class WP_Site_Health { 'label' => __( 'HTTP Requests' ), 'test' => 'http_requests', ), + 'rest_availability' => array( + 'label' => __( 'REST API availability' ), + 'test' => 'rest_availability', + 'skip_cron' => true, + ), 'debug_enabled' => array( 'label' => __( 'Debugging enabled' ), 'test' => 'is_in_debug_mode', @@ -2352,23 +2357,12 @@ class WP_Site_Health { ); // Conditionally include Authorization header test if the site isn't protected by Basic Auth. - if ( function_exists( 'wp_is_site_protected_by_basic_auth' ) ) { - if ( ! wp_is_site_protected_by_basic_auth() ) { - $tests['async']['authorization_header'] = array( - 'label' => __( 'Authorization header' ), - 'test' => rest_url( 'wp-site-health/v1/tests/authorization-header' ), - 'has_rest' => true, - 'headers' => array( 'Authorization' => 'Basic ' . base64_encode( 'user:pwd' ) ), - 'skip_cron' => true, - ); - } - } - - // Conditionally include REST rules if the function for it exists. - if ( function_exists( 'rest_url' ) ) { - $tests['direct']['rest_availability'] = array( - 'label' => __( 'REST API availability' ), - 'test' => 'rest_availability', + if ( ! wp_is_site_protected_by_basic_auth() ) { + $tests['async']['authorization_header'] = array( + 'label' => __( 'Authorization header' ), + 'test' => rest_url( 'wp-site-health/v1/tests/authorization-header' ), + 'has_rest' => true, + 'headers' => array( 'Authorization' => 'Basic ' . base64_encode( 'user:pwd' ) ), 'skip_cron' => true, ); }