-
Notifications
You must be signed in to change notification settings - Fork 85
fake_http_response
github-actions[bot] edited this page Oct 6, 2025
·
1 revision
Filters the return value of an HTTP request.
/**
* Filters the return value of an HTTP request.
*
* @param array $array
* @param string $url
* @param array $request
* @param mixed $request
* @return array The filtered value.
*/
function my_fake_http_response_callback( array array, string $url, array $request, $request ) {
// Your code here.
return array;
}
add_filter( 'fake_http_response', 'my_fake_http_response_callback', 10, 4 );
-
array
array
$response Array containing 'headers', 'body', 'response'. Other variable names:$json_decode
,$string_list
-
string
$url
The request URL. -
array
$request
Array of HTTP request arguments. $request
apply_filters(
'fake_http_response',
json_decode( file_get_contents( $cache ), true ), // phpcs:ignore WordPress.WP.AlternativeFunctions
$p['scheme'] . '://' . $p['host'],
$url,
$request
)
apply_filters(
'fake_http_response',
array(
'headers' => array(
'content-type' => 'text/json',
),
'body' => wp_json_encode( $response->data ),
'response' => array(
'code' =>
// ...
Follow @[email protected] for updates and news.