Site logo

Archived topic

Site Library Unavailable

4 replies · Started by Josue Gonzalez on April 19, 2021

Viewing posts 1–5 of 5

Hi Josue,

What's the error code you got? Is it cURL error 28?

If it is cURL error 28, could you contact your hosting for this issue?

Let me know.

Hi, thank you for your help.

There isn't any error in Query Monitor. API calls is empty.

Regards

I solved the problem with this code in functions.php inside GeneratePress theme:

add_action('http_api_curl', 'sar_custom_curl_timeout', 9999, 1);
function sar_custom_curl_timeout( $handle ){
curl_setopt( $handle, CURLOPT_CONNECTTIMEOUT, 30 ); // 30 seconds. Too much for production, only for testing.
curl_setopt( $handle, CURLOPT_TIMEOUT, 30 ); // 30 seconds. Too much for production, only for testing.
}
// Setting custom timeout for the HTTP request
add_filter( 'http_request_timeout', 'sar_custom_http_request_timeout', 9999 );
function sar_custom_http_request_timeout( $timeout_value ) {
return 30; // 30 seconds. Too much for production, only for testing.
}
// Setting custom timeout in HTTP request args
add_filter('http_request_args', 'sar_custom_http_request_args', 9999, 1);
function sar_custom_http_request_args( $r ){
$r['timeout'] = 30; // 30 seconds. Too much for production, only for testing.
return $r;
}

You can remove it after importing site library template.

Regards

Thanks for letting us know Josue :)

This archived topic is closed to new replies.