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 |
---|---|
1915 | ); |
1916 |
|
1917 | $cookies = wp_unslash( $_COOKIE ); |
1918 | $timeout = 10; |
1919 | $headers = array( |
1920 | 'Cache-Control' => 'no-cache', |
1921 | 'X-WP-Nonce' => wp_create_nonce( 'wp_rest' ), |
1922 | ); |
1923 | /** This filter is documented in wp-includes/class-wp-http-streams.php */ |
1924 | $sslverify = apply_filters( 'https_local_ssl_verify', false ); |
1925 |
|
1926 | // Include Basic auth in loopback requests. |
1927 | if ( isset( $_SERVER['PHP_AUTH_USER'] ) && isset( $_SERVER['PHP_AUTH_PW'] ) ) { |
1928 | $headers['Authorization'] = 'Basic ' . base64_encode( wp_unslash( $_SERVER['PHP_AUTH_USER'] ) . ':' . wp_unslash( $_SERVER['PHP_AUTH_PW'] ) ); |
1929 | } |
1930 |
|
1931 | $url = rest_url( 'wp/v2/types/post' ); |
1932 |
|
1933 | // The context for this is editing with the new block editor. |
Line | Code |
2430 | * @return object The test results. |
2431 | */ |
2432 | function can_perform_loopback() { |
2433 | $cookies = wp_unslash( $_COOKIE ); |
2434 | $timeout = 10; |
2435 | $headers = array( |
2436 | 'Cache-Control' => 'no-cache', |
2437 | ); |
2438 | /** This filter is documented in wp-includes/class-wp-http-streams.php */ |
2439 | $sslverify = apply_filters( 'https_local_ssl_verify', false ); |
2440 |
|
2441 | // Include Basic auth in loopback requests. |
2442 | if ( isset( $_SERVER['PHP_AUTH_USER'] ) && isset( $_SERVER['PHP_AUTH_PW'] ) ) { |
2443 | $headers['Authorization'] = 'Basic ' . base64_encode( wp_unslash( $_SERVER['PHP_AUTH_USER'] ) . ':' . wp_unslash( $_SERVER['PHP_AUTH_PW'] ) ); |
2444 | } |
2445 |
|
2446 | $url = admin_url(); |
2447 |
|
2448 | $r = wp_remote_get( $url, compact( 'cookies', 'headers', 'timeout', 'sslverify' ) ); |