wphats

An Unexpected HTTP Error occured during the API request

An Unexpected HTTP Error occured during the API request

Sometimes in WordPress you may face an error message  “An Unexpected HTTP Error occurred during the API request” when requesting a page from Admin Dashboard. It may happen for few minutes and after the panel starts behaving in a normal way. If you are getting this error frequently from your dashboard, then follow this simple steps to rid of this kind of situation.

WordPress gives 5 seconds time limit to request a plugin by default. If within 5 seconds it does not get a replay, the process will come to an halt and display an error “An Unexpected HTTP error occurred during the API request.”  To resolve this issue, you have to increase the time limit to a higher value. Just follow the steps:

STEP-1: Browse  WP-INCLUDE folder from root

STEP-2: Open class-http.php (latest wp versions) OR http.php (older wp-versions) file through notepad or available editor.

STEP-3: Find the below line :

[ HINTS: line number 96 from class-http.php file & line number 223 from http.php file]

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

STEP-4: Changed the line & make the timeout ’30’ seconds

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

STEP-5: Save & update the file.

http-request-timeout

That’s all.

This post has already been read 1171 times!

Mehedi Hasan

Cool WordPress Developer having much agile experience to develop any kind of WordPress sites & plugins. Also good in troubleshooting, fixing & making any kind of tweaks for WP site.

More Posts

POSTED ON: Wordpress Core
TAGGED :

Leave a Reply

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