0

I am writing a Wordpress plugin that makes calls to external sites. I want to raise the timeout for all wp_remote_* calls, so I added the following to the __construct function of my plugin:

add_filter("http_response_timeout", function($timeout) { return 30; });

But the calls still time out after 5 seconds. I also tried using a separate function as the second argument, same result. When I pass array("timeout" => 30) to the wp_remote_* functions directly, it works...

Any idea why the filter is not respected?

2

There is no filter named "http_response_timeout" in the WordPress core. Where are you finding this filter name from?

The timeout parameter as passed to a wp_remote call has a default of five seconds, and that default can be changed using the "http_request_timeout" filter, which is a different name than you used. Maybe you're just using the wrong word?

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.