Skip to content

Instantly share code, notes, and snippets.

@maheshwaghmare
Created January 12, 2023 11:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maheshwaghmare/247d6f16c7b462d577d09986faa1f323 to your computer and use it in GitHub Desktop.
Save maheshwaghmare/247d6f16c7b462d577d09986faa1f323 to your computer and use it in GitHub Desktop.
Increase the page speed request timeout from 30 seconds to 90 seconds.
<?php
add_filter( 'http_request_args', 'prefix_http_request_args', 10, 2 );
function prefix_http_request_args( $parsed_args, $url ) {
if ( false === strpos( $url, 'runPagespeed' ) ) {
return $parsed_args;
}
// Set timeout with 90 seconds.
$parsed_args['timeout'] = 90;
return $parsed_args;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment