Skip to content

Instantly share code, notes, and snippets.

@goblindegook
Created February 26, 2012 23:15
Show Gist options
  • Save goblindegook/1919587 to your computer and use it in GitHub Desktop.
Save goblindegook/1919587 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 );
?>
@raamdev
Copy link

raamdev commented May 16, 2019

@AbeCole thanks for catching that! I updated my comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment