Sometimes you will see an error message as ‘An Unexpected HTTP Error occurred during the API request’ after requesting a page on WordPress Admin Dashboard. It may happen for 2 -3 minutes and then after that the panel starts behaving in a normal way. If you are getting this error frequently on your dashboard, then here is a fix / solution for this error.

WordPress sets a timeout limit for every request. If that limit crosses for certain request, in that case you will get this message. If you need to resolve this issue, you can do that by increasing the time limit to a higher value. To increase the timeout limit of requests, go to the ‘wp-includes’ folder of your wordpress installation and edit http.php file over there. Here is the screenshot of the piece of code where you need to make the changes.


We have attached below the before and after changes in http.php file to avoid this error message.

Before Change

 'timeout' => apply_filters( 'http_request_timeout', 5),

After Changes

'timeout' => apply_filters( 'http_request_timeout', 30),

Since we have increased the time limit from 5 seconds to 30 seconds, now you will not get this error message in your admin panel. You may increase this timeout value with any amount as per your choice. As I told you that this error message is appearing because the page request is crossing the time limit. It may happens because of plugins used in your WordPress. If you are using lot many plugins which are not properly optimized, you may get this error. Go thru the wordpress optimization technique post to optimize your wordpress set to make your wordpress setup a bit lighter.

Update: In newer versions of WordPress, you will find the above code in class-http.php file in ‘wp-includes‘ folder of your WordPress installation.

By Sanjeev Mishra

Sanjeev Mishra is a professional blogger and an Internet Marketing Consultant based in India. He has built the Internet Techies to provide you updates in technology and web application area.

Leave a Reply

Your email address will not be published. Required fields are marked *