Created
November 21, 2015 01:06
-
-
Save afragen/dcf32c570d6a58056e2f to your computer and use it in GitHub Desktop.
Debug HTTP API calls in WordPress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'http_api_debug', 'viper_http_api_debug', 15, 5 ); | |
function viper_http_api_debug( $response, $type, $class, $args, $url ) { | |
// You can change this from error_log() to var_dump() but it can break AJAX requests | |
var_dump( "\n<br />" . 'Request URL: ' . var_export( $url, true ) ); | |
var_dump( "\n<br />" . 'Request Args: ' . var_export( $args, true ) ); | |
var_dump( "\n<br />" . 'Request Response : ' . var_export( $response, true ) ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment