WordPress Error During the API Request

The following error may occur when attempting to view plugins or themes in WordPress:

Error: An Unexpected HTTP Error occurred during the API request.

If this occurs, you can try editing the http.php file within the wp-includes folder of your WordPress installation. While editing the http.php file is a common fix for this issue, it is not a guaranteed fix as various issues can be the cause of this specific timeout error.

How to Edit the http.php File

To edit the http.php file:
  1. Log into cPanel.
  2. In the Files section, select the File Manager icon.
  3. Navigate to your WordPress installation.
  4. Open the wp-includes folder.
  5. Locate the http.php file and right-click on it.
  6. In the pop-up menu that appears, select the Edit option.
  7. In the next pop-up that appears, click Edit to open the Text Editor.
  8. Scroll down to find  the following line:
    'timeout' => apply_filters( 'http_request_timeout', 5),
  9. Update the line to the following:
    'timeout' => apply_filters( 'http_request_timeout', 30),
  10. Click Save Changes in the top-right corner.

Once these steps are complete, refresh the WordPress page to see if the error has been resolved.