Skip to content

Instantly share code, notes, and snippets.

@maheshwaghmare
Created January 12, 2023 11:49
Show Gist options
  • Select an option

  • Save maheshwaghmare/247d6f16c7b462d577d09986faa1f323 to your computer and use it in GitHub Desktop.

Select an option

Save maheshwaghmare/247d6f16c7b462d577d09986faa1f323 to your computer and use it in GitHub Desktop.

Revisions

  1. maheshwaghmare created this gist Jan 12, 2023.
    13 changes: 13 additions & 0 deletions increase-timeout.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    <?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;
    }