WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Within "install plugins" I'm receiving an error stating "An Unexpected HTTP Error occurred during the API request." When I do a plugin search it throws me back to my site's 404 page. Any idea what would prevent my site from syncing properly with WordPress's servers?

enter image description here

I added Hameedullah's code to functions.php and recevied this returned object(WP_Error)#21 (2) { ["errors"]=> array(1) { ["http_request_failed"]=> array(1) { [0]=> string(75) "Could not resolve host: api.wordpress.org; No data record of requested type" } } ["error_data"]=> array(0) { } }

Is this a curl transport issue?

share|improve this question
have you tried enabling debug mode and see if any PHP errors are shown? – Brady May 18 '11 at 14:42
I haven't, are you using a plugin? – Zach Shallbetter May 18 '11 at 14:56
Here is how to enable debug – Brady May 18 '11 at 15:07
Wow, so I used debug and the return was terrifying. I'm not sure even where to begin here. I don't see anything related to the plugin section of the site. pastebin.com/vrnk0ER0 – Zach Shallbetter May 18 '11 at 16:13
All those errors are notices and and wouldn't cause a HTTP error – Brady May 18 '11 at 16:24
up vote 3 down vote accepted

You can use the following code to dump the HTTP Api response, will help you figure out the cause of error.

function dump_http_api_response($response, $type="", $transport=null ) {
    if ( $type == "response" )
        var_dump ( $response );
add_action('http_api_debug', 'dump_http_api_response', 1, 3);

Example Output:

object(WP_Error)#15 (2) { ["errors"]=> array(1) { ["http_request_failed"]=> array(1) { [0]=> string(41) "Couldn't resolve host 'api.wordpress.org'" } } ["error_data"]=> array(0) { } }
share|improve this answer
Thanks Hameedullah, what should I be looking for as a result? – Zach Shallbetter May 18 '11 at 16:13
In case of error 99.9% chances are the $response will be a WP_Error object. I am updating my answer to show the example dump. I have also made minor adjustment to add_action call to include priority and expected number of arguments. – Hameedullah Khan May 18 '11 at 16:24
That worked, I've updated my post with the return. – Zach Shallbetter May 18 '11 at 16:37
This ultimately solved my issue. The problem was Windows had dropped the gateway which was preventing WordPress from accessing anything externally. – Zach Shallbetter May 18 '11 at 16:59

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.