Yesterday while I was busy updating a couple of my WordPress blogs, on one of the blogs I kept on getting an unexpected error when I was trying to add and update plugins – An unexpected HTTP Error occurred during the API request.

To be honest, I was totally baffled by this error as this was the first time I got the error. This was a really big problem because I wasn’t able to update or add any of the necessary plugins to make the WordPress website work.

Research research research

After searching and doing some research on ways to fix this error I realised that this was quite a common error and there are a lot of people who had this error before. All the fixes that I have found online was for WordPress versions prior to 3.0 and it involves editing the http.php file in the
wp-includes folder found on the root of your WordPress installation.

Here’s the fix that I have found. Find this code on-line no 223 in http.php in the wp-includes folder.

{code type=PHP}
‘timeout’ => apply_filters( ‘http_request_timeout’, 5);

Replace that code with:

{code type=PHP}
‘timeout’ => apply_filters( ‘http_request_timeout’, 30);

This will not work if you are running a WordPress version 3 or higher as the above code is not in the http.php file anymore but in the class-http.php file also found in the wp-includes folder.

By replacing the code above resolved the nasty HTTP error I was getting. Hope it works for you!

Book Your FREE Consultation

Take the first step to double your leads and sales. Schedule your complimentary 30-minute consultation now.







    There’s no commitment, just FREE, personalised, actionable strategies to build your business online!

    Free GA4 Ecommerce Marketing Dashboard

    Start measuring the ROI of your online store with the FREE Google Analytics 4 Ecommerce Marketing Dashboard template.







      You will be emailed a link to the report.

      Pin It on Pinterest