Is cURL 28: connection timeout error showing on your WordPress site?
The cURL error 28 is a common problem with the WordPress REST API that can affect the performance of your website and lead to unpredictable behavior.
In this article, we are going to show you how to easily fix the "cURL Error 28: Connection Timed Out" issue on your WordPress website.
What is curl in WordPress?
The cURL is a software utility used by WordPress and many other web applications for sending and receiving data requests through URLs.
WordPress uses cURL to handle multiple API requests. It's available as an extension of the PHP programming language and your WordPress hosting company will take care of it.
The cURL library plays a vital role in how WordPress works behind the scenes. If it's not configured correctly, your WordPress website will not work properly.
What Causes CURL Error 28 in WordPress?
Failure to respond to the server's data requests in a timely manner will cause cURL error 28 in WordPress.
WordPress uses the REST API (a programming technique) to send and receive data requests. If these requests time out, this will be indicated as a critical issue in the Site Health report titled "The REST API Mistakenly Occurred".
If you expand the error you will see more details including the error message:
Error: cURL error 28: Operation timed out after x milliseconds with x received bytes (http_request_failed)
You may also see another related issue, titled "Your website could not complete a loopback request". You receive a similar error message that is described below.
"The loopback request to your site failed. This means that the functions based on it are not currently working as expected."
What can cause the cURL to time out?
A number of scenarios can cause the cURL to time out in WordPress.
For example, a WordPress firewall plugin can block a REST API request that is considered suspicious activity.
If your DNS server is not working properly it can also fail HTTP requests and cause the cURL timeout error in WordPress.
A poorly configured WordPress hosting server may have a very low timeout threshold, which may prevent certain WordPress processes from running properly.
Let's take a look at how to fix and fix the "Curl Error 28: Connection Timed Out" issue in WordPress.
1. Temporarily disable the WordPress firewall
If you're using a WordPress firewall or security plugin, temporarily disable it.
After that, you need to visit the WordPress site health report page to see if your problem has been fixed.
If so, you will need to check your WordPress firewall logs to see which API requests have been blocked.
This would either identify the source of the problem or you can adjust the firewall settings so as not to block legitimate API requests.
2. Deactivate all WordPress plugins
WordPress plugins have their own API requirements for sending and receiving data. If these calls are too frequent or take too long, it can cause the cURL error on your site health report.
The easiest way to find out is to disable all WordPress plugins. Just go to the Plugins »Installed plugins Page and select all plugins.
Then click the Bulk Actions drop down list to select Disable and then click the Apply button.
You can now visit the Site Health report to see if the problem is resolved. If this solves the problem, you can activate your plugins one at a time until the problem occurs again.
That way you can find the plugin that may be causing the problem and ask the plugin author for assistance.
3. Make sure your hosting server is using the latest software
The next step is to make sure that your WordPress hosting server is using the latest versions of PHP, cURL library, and OpenSSL.
You can verify this by clicking the System Information tab under Tools »Site Health Page.
Just go to the Info tab and expand the Server section. Get information on software installed on your WordPress hosting server here.
Ideally, your server should be running PHP 7.4.13 or higher, Curl 7.74.0 or higher, and OpenSSL 1.1.1 or higher.
If it doesn't, you will need to contact your WordPress hosting company and ask them to update the software for your hosting account.
4. Resolve problems with unsecured SSL content
If your WordPress site uses HTTPS / SSL but it is not configured properly, it can also cause your web server to block insecure cURL requests.
If your WordPress site doesn't use HTTPS / SSL but makes an API call using an HTTP URL, these requests will also fail and you may see the following cURL error instead:
‘Error: cURL error 7: connection to localhost port 443 failed: connection refused (http_request_failed)
To fix this, you can ask your hosting provider to reinstall the SSL certificate for your website. If the problem persists, follow our guide on fixing common SSL issues to properly set up SSL on your WordPress website.
5. Contact the hosting provider
If the above steps fail to fix the cURL error 28 on your WordPress site, most likely the problem is due to a problem with the hosting environment.
There are many factors that only your hosting company can control and correct. For example, if your DNS servers cannot resolve requests in a timely manner, cURL requests will time out.
Another scenario could be slower connectivity or network problems with your hosting server.
Just send them a support request with the bug details and the tech staff can fix bugs and apply a fix to resolve the issue.
We hope this article has helped you fix cURL error 28 in WordPress. You may also want to bookmark our WordPress troubleshooting tips and our ultimate guide to fixing common WordPress errors.
If you enjoyed this article, please subscribe to our YouTube channel for WordPress video tutorials. You can also find us on Twitter and Facebook.