Beginner's Guide for WordPress / Start your WordPress Blog in minutes

How to Fix cURL Error 28: Connection Timed Out After X Milliseconds

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 affect 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.

Fixing the cURL error 28: Connection timed out issue in WordPress

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 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’.

cURL error 28 shown in WordPress site health report

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 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 timeout threshold that stops certain WordPress processes from running properly.

That being said, let’s take a look at how to troubleshoot and solve a 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.

Deactivate WordPress firewall plugin

After that, you just need to 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 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 figure out if your WordPress plugins are causing issues is by deactivating all of them. Simply go to the Plugins » Installed Plugins page and select all plugins.

Deactivate all WordPress plugins

After that, click on the Bulk Actions drop-down 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 resolved 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 WordPress 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.

System information report under site health

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.

Check PHP, cURL, and OpenSSL versions

Ideally, your server should be using PHP 7.4.13 or higher, curl 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 it is not configured properly, then this could also cause your web server to 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)’

cURL error 7 in WordPress

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, then the problem is most likely 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.

We hope this article helped you learn how to fix the cURL error 28 in WordPress. You may also want to bookmark our WordPress troubleshooting tips 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.

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. See how WPBeginner is funded, why it matters, and how you can support us. Here's our editorial process.

The Ultimate WordPress Toolkit

Get FREE access to our toolkit - a collection of WordPress related products and resources that every professional should have!

Reader Interactions

2 CommentsLeave a Reply

  1. 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

Leave A Reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.