Make WordPress Core

Ticket #57440: 57440.diff

File 57440.diff, 1.1 KB (added by mcaskill, 2 years ago)

Add filter "site_status_test_rest_availability_url" to get_test_rest_availability()

  • src/wp-admin/includes/class-wp-site-health.php

    diff --git a/src/wp-admin/includes/class-wp-site-health.php b/src/wp-admin/includes/class-wp-site-health.php
    index cfc88314a5..4596f655d3 100644
    a b class WP_Site_Health { 
    20742074                 $headers['Authorization'] = 'Basic ' . base64_encode( wp_unslash( $_SERVER['PHP_AUTH_USER'] ) . ':' . wp_unslash( $_SERVER['PHP_AUTH_PW'] ) );
    20752075                }
    20762076
    2077                 $url = rest_url( 'wp/v2/types/post' );
     2077                // By default, the route for this is the 'post' post type.
     2078                $path = 'wp/v2/types/post';
     2079
     2080                $url = rest_url( $path );
    20782081
    20792082                // The context for this is editing with the new block editor.
    20802083                $url = add_query_arg(
    class WP_Site_Health { 
    20842087                 $url
    20852088                );
    20862089
     2090                /**
     2091                 * Filters the REST API URL for the REST API availability health check.
     2092                 *
     2093                 * @param string $url  REST URL.
     2094                 * @param string $path REST route.
     2095                 */
     2096                $url = apply_filters( 'site_status_test_rest_availability_url', $url, $path );
     2097
    20872098                $r = wp_remote_get( $url, compact( 'cookies', 'headers', 'timeout', 'sslverify' ) );
    20882099
    20892100                if ( is_wp_error( $r ) ) {