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 2 times in this file.
Line | Code |
---|---|
1922 | ); |
1923 |
|
1924 | $cookies = wp_unslash( $_COOKIE ); |
1925 | $timeout = 10; |
1926 | $headers = array( |
1927 | 'Cache-Control' => 'no-cache', |
1928 | 'X-WP-Nonce' => wp_create_nonce( 'wp_rest' ), |
1929 | ); |
1930 | /** This filter is documented in wp-includes/class-wp-http-streams.php */ |
1931 | $sslverify = apply_filters( 'https_local_ssl_verify', false ); |
1932 |
|
1933 | // Include Basic auth in loopback requests. |
1934 | if ( isset( $_SERVER['PHP_AUTH_USER'] ) && isset( $_SERVER['PHP_AUTH_PW'] ) ) { |
1935 | $headers['Authorization'] = 'Basic ' . base64_encode( wp_unslash( $_SERVER['PHP_AUTH_USER'] ) . ':' . wp_unslash( $_SERVER['PHP_AUTH_PW'] ) ); |
1936 | } |
1937 |
|
1938 | $url = rest_url( 'wp/v2/types/post' ); |
1939 |
|
1940 | // The context for this is editing with the new block editor. |
Line | Code |
2518 | * @return object The test results. |
2519 | */ |
2520 | function can_perform_loopback() { |
2521 | $cookies = wp_unslash( $_COOKIE ); |
2522 | $timeout = 10; |
2523 | $headers = array( |
2524 | 'Cache-Control' => 'no-cache', |
2525 | ); |
2526 | /** This filter is documented in wp-includes/class-wp-http-streams.php */ |
2527 | $sslverify = apply_filters( 'https_local_ssl_verify', false ); |
2528 |
|
2529 | // Include Basic auth in loopback requests. |
2530 | if ( isset( $_SERVER['PHP_AUTH_USER'] ) && isset( $_SERVER['PHP_AUTH_PW'] ) ) { |
2531 | $headers['Authorization'] = 'Basic ' . base64_encode( wp_unslash( $_SERVER['PHP_AUTH_USER'] ) . ':' . wp_unslash( $_SERVER['PHP_AUTH_PW'] ) ); |
2532 | } |
2533 |
|
2534 | $url = admin_url(); |
2535 |
|
2536 | $r = wp_remote_get( $url, compact( 'cookies', 'headers', 'timeout', 'sslverify' ) ); |