Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save uhlhosting/45467da63872e1119a52abc8981e6c9c to your computer and use it in GitHub Desktop.
Save uhlhosting/45467da63872e1119a52abc8981e6c9c to your computer and use it in GitHub Desktop.
Adjust WordPress HTTP request timeout
<?php
function my_http_request_args ( $r )
{
$r['timeout'] = 15; # new timeout
return $r;
}
add_filter( 'http_request_args', 'my_http_request_args', 100, 1 );
function my_http_api_curl ( $handle )
{
curl_setopt( $handle, CURLOPT_CONNECTTIMEOUT, 15 ); # new timeout
curl_setopt( $handle, CURLOPT_TIMEOUT, 15 ); # new timeout
}
add_action( 'http_api_curl', 'my_http_api_curl', 100, 1 );
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment