WP hooks navigation: Home/browse • Actions index • Filters index
To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).
The best way to understand what a hook does is to look at where it occurs in the source code.
do_action( "hook_name" )
apply_filters( "hook_name", "what_to_filter" )
.Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.
This hook occurs 3 times in this file.
Line | Code |
---|---|
2067 | ); |
2068 |
|
2069 | $cookies = wp_unslash( $_COOKIE ); |
2070 | $timeout = 10; // 10 seconds. |
2071 | $headers = array( |
2072 | 'Cache-Control' => 'no-cache', |
2073 | 'X-WP-Nonce' => wp_create_nonce( 'wp_rest' ), |
2074 | ); |
2075 | /** This filter is documented in wp-includes/class-wp-http-streams.php */ |
2076 | $sslverify = apply_filters( 'https_local_ssl_verify', false ); |
2077 |
|
2078 | // Include Basic auth in loopback requests. |
2079 | if ( isset( $_SERVER['PHP_AUTH_USER'] ) && isset( $_SERVER['PHP_AUTH_PW'] ) ) { |
2080 | $headers['Authorization'] = 'Basic ' . base64_encode( wp_unslash( $_SERVER['PHP_AUTH_USER'] ) . ':' . wp_unslash( $_SERVER['PHP_AUTH_PW'] ) ); |
2081 | } |
2082 |
|
2083 | $url = rest_url( 'wp/v2/types/post' ); |
2084 |
|
2085 | // The context for this is editing with the new block editor. |
Line | Code |
2934 | */ |
2935 | public function can_perform_loopback() { |
2936 | $body = array( 'site-health' => 'loopback-test' ); |
2937 | $cookies = wp_unslash( $_COOKIE ); |
2938 | $timeout = 10; // 10 seconds. |
2939 | $headers = array( |
2940 | 'Cache-Control' => 'no-cache', |
2941 | ); |
2942 | /** This filter is documented in wp-includes/class-wp-http-streams.php */ |
2943 | $sslverify = apply_filters( 'https_local_ssl_verify', false ); |
2944 |
|
2945 | // Include Basic auth in loopback requests. |
2946 | if ( isset( $_SERVER['PHP_AUTH_USER'] ) && isset( $_SERVER['PHP_AUTH_PW'] ) ) { |
2947 | $headers['Authorization'] = 'Basic ' . base64_encode( wp_unslash( $_SERVER['PHP_AUTH_USER'] ) . ':' . wp_unslash( $_SERVER['PHP_AUTH_PW'] ) ); |
2948 | } |
2949 |
|
2950 | $url = site_url( 'wp-cron.php' ); |
2951 |
|
2952 | /* |
Line | Code |
3185 | * |
3186 | * @type bool $advanced_cache_present Whether a page cache plugin is present. |
3187 | * @type array[] $page_caching_response_headers Sets of client caching headers for the responses. |
3188 | * @type float[] $response_timing Response timings. |
3189 | * } |
3190 | */ |
3191 | private function check_for_page_caching() { |
3192 |
|
3193 | /** This filter is documented in wp-includes/class-wp-http-streams.php */ |
3194 | $sslverify = apply_filters( 'https_local_ssl_verify', false ); |
3195 |
|
3196 | $headers = array(); |
3197 |
|
3198 | // Include basic auth in loopback requests. Note that this will only pass along basic auth when user is |
3199 | // initiating the test. If a site requires basic auth, the test will fail when it runs in WP Cron as part of |
3200 | // wp_site_health_scheduled_check. This logic is copied from WP_Site_Health::can_perform_loopback(). |
3201 | if ( isset( $_SERVER['PHP_AUTH_USER'] ) && isset( $_SERVER['PHP_AUTH_PW'] ) ) { |
3202 | $headers['Authorization'] = 'Basic ' . base64_encode( wp_unslash( $_SERVER['PHP_AUTH_USER'] ) . ':' . wp_unslash( $_SERVER['PHP_AUTH_PW'] ) ); |
3203 | } |