Are you seeing the cURL error 28: Connection timed out error on your WordPress site?
The cURL error 28 is a common WordPress REST API issue that can hurt your website’s performance and may cause it to behave unpredictably.
In this article, we will show you how to easily fix the ‘cURL error 28: Connection timed out’ issue on your WordPress website.
Here is a quick overview of the topics we will cover in this tutorial:
- What Is cURL in WordPress?
- What Causes the cURL Error 28 in WordPress?
- Temporarily Disable the WordPress Firewall
- Deactivate All WordPress Plugins
- Ensure Your Hosting Server Is Using the Latest Software
- Fix SSL Insecure Content Issues
- Seek Help from Your Hosting Provider
- Get Professional Help With WordPress Maintenance Services
What Is cURL in WordPress?
The cURL is a software utility used by WordPress and many other web applications to send and receive data requests using URLs.
WordPress uses cURL to handle several API requests. It is available as an extension of the PHP programming language, and your WordPress hosting company takes care of it.
The cURL library plays an important role in how WordPress works behind the scenes. If it is not configured properly, then your WordPress website will not function properly.
What Causes the cURL Error 28 in WordPress?
Failure to respond to the server’s data requests in a timely manner causes cURL error 28 in WordPress.
WordPress uses REST API (a programming technique) to send and receive data requests. If these requests time out, then you will see a critical issue in the Site Health report with the title ‘The REST API encountered an error’.
Expanding the error will show you further details, including the error message:
‘Error: cURL error 28: Operation timed out after x milliseconds with x bytes received (http_request_failed)’
You may also see another related issue with the title ‘Your site could not complete a loopback request’. It will have a similar error message with the following description.
‘The loopback request to your site failed, this means features relying on them are not currently working as expected.’
What Can Cause cURL to Time Out?
A number of scenarios may cause the cURL to time out in WordPress.
For instance, a WordPress firewall plugin like Cloudflare may block a REST API request because it considers it to be suspicious activity.
If your DNS server is not working correctly, then this may also fail HTTP requests and cause the cURL timeout error in WordPress.
A poorly configured WordPress hosting server may simply have a very low connection timeout threshold that stops certain WordPress processes from running properly.
That being said, let’s take a look at how to troubleshoot and solve the ‘cURL error 28: Connection timed out issue’ in WordPress.
1. Temporarily Disable the WordPress Firewall
If you are using a WordPress firewall or a security plugin, then go ahead and temporarily deactivate it.
After that, you can visit the WordPress Site Health report page to see if your issue has been resolved.
If it has, then simply check your WordPress firewall logs to see which API requests have been blocked.
This would either identify the source of the issue, or you can adjust the firewall settings to not block legitimate API requests.
2. Deactivate All WordPress Plugins
WordPress plugins and WordPress themes make their own API requests to send and receive data. If these calls are too frequent or take too long to complete, then they may cause the cURL error in your Site Health report.
The easiest way to determine if your WordPress plugins are causing issues is by deactivating them. Simply go to the Plugins » Installed Plugins page and select all plugins.
After that, click on the Bulk Actions dropdown menu to select ‘Deactivate’ and then click on the ‘Apply’ button.
You can now visit the Site Health report to see if the issue has disappeared. If this fixed the problem, then you can start activating your plugins and check if one of them causes the error message to reappear.
This will help you find the plugin that may be causing the issue, and you can then ask the plugin author for support.
3. Ensure Your Hosting Server Is Using the Latest Software
The next step is to make sure that your web hosting server is using the latest versions of PHP, cURL library, and OpenSSL.
You can check that by looking at the system information tab on the Tools » Site Health page.
Simply switch to the ‘Info’ tab and expand the ‘Server’ section.
From here, you can get information about software installed on your WordPress hosting server.
Ideally, your server should be using PHP 7.4.13 or higher, cURL version 7.74.0 or higher, and OpenSSL 1.1.1 or higher.
If it doesn’t, then you will need to contact your WordPress hosting company and ask them to update your WordPress to the latest software versions for your hosting account.
4. Fix SSL Insecure Content Issues
If your WordPress site is using HTTPS/SSL but is not configured properly, your web server could also block insecure cURL requests.
Similarly, if your WordPress site doesn’t use HTTPS/SS, but it made an API call using an HTTPS URL, then those requests will fail too, and you may see the following cURL error instead:
‘Error: cURL error 7: Failed to connect to localhost port 443: Connection refused (http_request_failed)’
To fix this, you can ask your hosting provider to re-install the SSL certificate for your website. If the issue persists, then follow our guide on how to fix common SSL issues to properly set up SSL on your WordPress website.
5. Seek Help from Your Hosting Provider
If the above steps fail to resolve the cURL error 28 on your WordPress site, the problem will likely be a hosting environment issue.
There are many factors that can only be controlled and fixed by your hosting company. For instance, if their DNS servers are unable to resolve requests in a timely manner, then this will cause cURL requests to time out.
Another scenario could be slower connectivity or networking issues with your hosting server.
If the problem is still there, contact the hosting support team with a support request containing the error details. Then, their technical staff can troubleshoot and apply a fix to solve it.
If your host isn’t very helpful, it might be time to switch to a managed WordPress hosting provider like SiteGround. With SiteGround, you will have access to 24/7 expert technical support, along with blazing-fast servers and premium WordPress security.
6. Get Professional Help With WordPress Maintenance Services
Are you sick of spending so much time fixing errors on your WordPress website? Wouldn’t you rather have that time to focus on growing your business?
It might be time to consider professional WordPress maintenance services.
Our WPBeginner Maintenance and Support Services can take care of everything from automatic updates and backups to error troubleshooting. you’ll also have access to 24/7 expert support if things go wrong on your website.
We hope this article helped you learn how to fix cURL error 28 in WordPress. You may also want to see our complete WordPress troubleshooting guide and our ultimate handbook on fixing common WordPress errors.
If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.
Syed Balkhi
Hey WPBeginner readers,
Did you know you can win exciting prizes by commenting on WPBeginner?
Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
You can get more details about the contest from here.
Start sharing your thoughts below to stand a chance to win!
Jiří Vaněk
Thank you for the great advice. Personally, I was only able to solve the issue after consulting with the server admin and updating PHP. I didn’t come to any direct specific reasons, but your suggestion to focus on the currently used software helped. The problematic website was running on the old PHP 7.1, and the newer version 8.2 resolved the issue.
Miguel
The problem consists of what PHP you are using if the plugin or theme is not yet tested and working on PHP over 7.4 you will get those errors
WPBeginner Support
Thanks for sharing this for those looking for other possible reasons!
Admin