To analyze performance of a WordPress site it can sometimes be insightful to know how wp_remote_get()
and other functions that relies on WP_Http
are used, and what external requests are happening in the background.
To enable logging of requests, one can use the hook http_api_debug
like this for example:
function templ_http_api_debug_logger( $response, $context, $class, $parsed_args, $url ) {
error_log( 'http_api_debug: '.$url );
}
add_action('http_api_debug', 'templ_http_api_debug_logger', 10, 5);
If you have WP_DEBUG
and WP_DEBUG_LOG
enabled, this will output to debug.log every time a request is made.