Action hook 'http_api_debug'

in WP Core File wp-includes/class-wp-http.php at line 613

View Source

http_api_debug

Action Hook
Description
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 Action
Line Number 613

Hook Parameters

Type Name Description
string $url URL to request.
array $args Request arguments.

Usage Examples

Basic Usage
<?php
// Hook into http_api_debug
add_action('http_api_debug', 'my_custom_function', 10, 2);

function my_custom_function($url, $args) {
    // Your custom code here
}

Source Code Context

wp-includes/class-wp-http.php:613 - How this hook is used in WordPress core
<?php
 608  		}
 609  
 610  		$response = $transports[ $class ]->request( $url, $args );
 611  
 612  		/** This action is documented in wp-includes/class-wp-http.php */
 613  		do_action( 'http_api_debug', $response, 'response', $class, $args, $url );
 614  
 615  		if ( is_wp_error( $response ) ) {
 616  			return $response;
 617  		}
 618  

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: Action
  • Parameters: 2
  • File: wp-includes/class-wp-http.php
Related Hooks

Related hooks will be displayed here in future updates.