Tarek Chaaban

Tarek Chaaban, M.Sc's official blog. It contains current web project portfolio, posts regarding his Canadian army experience, news, sports articles, and web tutorials on programming and using social networking technologies.

An Unexpected HTTP Error occurred during the API request

wordpress api

wordpress api

I recently changed host for my website and suddenly started seeing this message in my wordpress admin dashboard :

An Unexpected HTTP Error occurred during the API request

Made some searches and found the following explanation by efree_unix :

The cause of error is too long in the process of requesting the API plugin in the wordpress server so that the operation timed out.

By default, wordpress give 5 seconds time limit to request a plugin. If within 5 seconds does not get a replay, then the process will be stopped and displayed an error “An Unexpected HTTP error occurred during the API request.”

So the Solution he proposed :

Open wp_include/http.php file on line 223

‘timeout’ => apply_filters( ‘http_request_timeout’, 5),

change the script above into

‘timeout’ => apply_filters( ‘http_request_timeout’, 30),

This should fix the issue of the “An Unexpected HTTP Error occurred during the API request

Tagged as: , , , ,


  1. Not working as expected ;) WordPress just wait longer for ‘deploy’ the error message

  2. - Try a bigger number (45) ?

    - disable all plugins and start enabling them 1 by 1 and see which one is causing the problem

  3. This issue may also reside within the WordPress API. The biggest culprit being sexybookmarks, it works fine on some of my sites, and not so on others, but a lot of people have found removing this from your site via ftp and refreshing your dashboard fixes it. That said, there may still be an issue with adding new plugins automatically via the dashboard, as I have had to install some manually.

    Another reason for this issue in general with having lots of plugins is the cache. When you load your site and refresh, most of it has been cached, however, if you are refreshing your dashboard, none of it is cached, so you have to load everything. So 5 seconds is a bit stingy. One potential solution to that is to have supercache installed. Which allows you to cache your dashboard and thus increase the speed of your dashboards loading time. :)

  4. This problem is resolved 4 out 5 times in the above given method. But for some they just have to wait until the error mysteriously disappears by itself. WordPress has no absolute solution for it..

  5. I am getting the error, however I don’t even have that line of code in my http.php file… Can someone give me the full code to add it to the file or could there be other causes for this error?

    THANKS! :)

  6. Same as Lisa, I can not find that line of code. Seems like WP3 has changed several files :(

  7. You don’t mention the WordPress version which you solved for. I have tried it in WordPress v3.0 and it not worked for me. Could you please give me solution for WordPress v3.0?

    Thanks in advance.

  8. Lisa -

    The reason you may not see the code in http.php is because your WP is version 3.0. If you are using WordPress version 3.0 the code is in /wp-includes/class-http.php file on line 220.


  9. I have use wp 3.0.1 but not found

  10. if WP is version 3.0 above

    ‘timeout’ => apply_filters( ‘http_request_timeout’, 5),

    change to

    ‘timeout’ => apply_filters( ‘http_request_timeout’, 30)

  11. Hello!

    This is not working :(
    i spend my maximum time on this but still i am getting this error.
    now what can i do for this issue.
    i tried maximum number on the timeout line.
    5 to 90 and 130.
    but still it didn’t work. :(
    Please Help me on this. :(



    Mohsin Ayub

  12. hey i applied this in my wordpress.changed value but still getting same error.i am using latest version of WP.Any help please?


  13. if wp 3.0 and higher edit from wp-includes/class-http.php

  14. I am getting this error in my localhost. Why doesn’t it work? Fixed the class-http file, but no cigar. What’s the problem here? I am getting this problem importing a simple xml file, exported from WordPress of the same version! (3.2.1)

Leave a Response

Please note: comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.