How to Fix cURL Error 28 in WordPress  – Increase HTTP Request Timeout)

WordPress websites constantly communicate with external services behind the scenes. Payment gateways, CRMs, email marketing platforms, shipping providers, and automation tools all rely on outgoing HTTP requests.

If these requests take too long, WordPress may terminate them early. When this happens you might see errors such as:

  • cURL error 28
  • WordPress HTTP request timeout
  • Operation timed out after X milliseconds
  • wp_remote_post timeout

In many cases the problem is not the external service. Instead, the WordPress timeout value is simply too low.

Fortunately, this can be fixed with a small code snippet.


Why WordPress HTTP Requests Fail

WordPress uses its internal HTTP API to send requests to external services. This is used by many common plugins and integrations.

Examples include:

  • Payment gateways like Stripe or PayPal
  • Shipping providers like FedEx or UPS
  • Email platforms such as Mailchimp, ActiveCampaign, or Brevo
  • Automation tools like Zapier or Make
  • Internal background jobs via WP-Cron
  • CRM integrations and webhook connections

By default, WordPress sets the HTTP request timeout to only 5 seconds.

If your server is under load or the external API responds slowly, the request may be terminated before it finishes.

When this happens, the process simply stops. Sometimes a log entry exists, but often the user sees no visible error.


Common Symptoms of WordPress Timeout Issues

Timeout problems can cause confusing behavior on WordPress sites. Some common examples include:

  • A Stripe payment succeeds, but the form entry is never saved in WordPress.
  • WooCommerce shipping rates stop loading at checkout.
  • Form submissions stop syncing contacts to email marketing platforms.
  • Zapier or Make webhooks fire but send incomplete data.
  • WP-Cron jobs that call APIs stop finishing.
  • Integrations with CRMs or external databases silently fail.

In many cases these issues are caused by the 5-second timeout limit.


How to Increase the WordPress HTTP Request Timeout

You can increase the timeout using the http_request_timeout filter.

Add the following code to your child theme’s functions.php file or use the Code Snippets plugin.

add_filter('http_request_timeout', function($timeout) {
  return 30;
}, 10, 1);

This changes the timeout value to 30 seconds.

Since WordPress defaults to 5 seconds, even increasing it to 15 or 30 seconds can dramatically reduce timeout errors.


Where to Add the Code

There are two common ways to add the snippet.

Option 1: Child Theme functions.php

Add the code inside:

/wp-content/themes/your-child-theme/functions.php

Option 2: Code Snippets Plugin

If you prefer not to edit theme files, install the Code Snippets plugin and add the snippet there.

This is often safer and easier for non-developers.


Choosing the Right Timeout Value

The ideal timeout depends on your server and integrations.

Typical values used by developers:

TimeoutWhen to use
10–15 secondsSmall API requests
20–30 secondsPayment gateways, webhooks
30+ secondsSlow APIs or heavy integrations

Most sites work well with 15–30 seconds.

Setting extremely high values is usually unnecessary.


Important Limitation of This Fix

This solution only works for requests made through the WordPress HTTP API.

That includes functions such as:

  • wp_remote_get()
  • wp_remote_post()
  • wp_remote_request()

However, some plugins bypass the WordPress API and make direct cURL calls using:

curl_init()

If a plugin does this, the http_request_timeout filter will not apply.

This is rare, but if timeout errors continue after adding the snippet, it may indicate that the plugin is making direct cURL requests.


Final Thoughts

Timeout issues in WordPress are more common than most developers realize. Because the default HTTP request timeout is only 5 seconds, slow APIs or overloaded servers can easily cause requests to fail silently.

Increasing the timeout value is a simple fix that can prevent issues such as:

  • Failed payment confirmations
  • Broken API integrations
  • Incomplete webhook data
  • Background jobs stopping mid-process

A small adjustment like increasing the timeout to 15 or 30 seconds can make WordPress integrations far more reliable.