Created
February 26, 2012 23:15
-
-
Save goblindegook/1919587 to your computer and use it in GitHub Desktop.
Adjust WordPress HTTP request timeout
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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
@raamdev code has incorrectly spelt function name, "__extend_http_reqest_timeout" is missing the "u" in "request".
Correct snippet is: