http_response
Filter HookDescription
Dispatches a HTTP request to a supporting transport. Tests each transport in order to find a transport which matches the request arguments. Also caches the transport instance to be used later. The order for requests is cURL, and then PHP Streams. A WP_Error instance upon error.Hook Information
File Location |
wp-includes/class-wp-http.php
View on GitHub
|
Hook Type | Filter |
Line Number | 620 |
Hook Parameters
Type | Name | Description |
---|---|---|
string
|
$url
|
URL to request. |
array
|
$args
|
Request arguments. |
Usage Examples
Basic Usage
<?php
// Hook into http_response
add_filter('http_response', 'my_custom_filter', 10, 2);
function my_custom_filter($url, $args) {
// Your custom filtering logic here
return $url;
}
Source Code Context
wp-includes/class-wp-http.php:620
- How this hook is used in WordPress core
<?php
615 if ( is_wp_error( $response ) ) {
616 return $response;
617 }
618
619 /** This filter is documented in wp-includes/class-wp-http.php */
620 return apply_filters( 'http_response', $response, $args, $url );
621 }
622
623 /**
624 * Uses the POST HTTP method.
625 *
PHP Documentation
<?php
/**
* Dispatches a HTTP request to a supporting transport.
*
* Tests each transport in order to find a transport which matches the request arguments.
* Also caches the transport instance to be used later.
*
* The order for requests is cURL, and then PHP Streams.
*
* @since 3.2.0
* @deprecated 5.1.0 Use WP_Http::request()
* @see WP_Http::request()
*
* @param string $url URL to request.
* @param array $args Request arguments.
* @return array|WP_Error Array containing 'headers', 'body', 'response', 'cookies', 'filename'.
* A WP_Error instance upon error.
*/
Quick Info
- Hook Type: Filter
- Parameters: 2
- File: wp-includes/class-wp-http.php
Related Hooks
Related hooks will be displayed here in future updates.