Skip to main content

PDF for GravityView Hooks – gfpdf_gv_static_map_timeout

Description​

Sets how many seconds a GravityView PDF waits for Google to return one map image. The default is 5.

Raise it if maps show "Map could not be rendered." or are missing, and your Static Maps key passes its check. The request to Google may be timing out, which is common on a slow connection or on a host that sends outbound requests through a proxy.

The timeout is set on every Static Maps request, so WordPress's http_request_timeout filter has no effect on it. This filter is the only way to change it.

Maps in a Multiple Entries PDF are fetched ten at a time, and each batch can take up to the full timeout. A longer timeout raises the worst-case generation time. Keep it well under your server's max_execution_time, or the PDF won't generate at all. gfpdf_gv_static_map_max_fetches caps how many maps one PDF fetches.

Version​

This hook was introduced in PDF for GravityView 2.0.

Arguments​

The following arguments are passed to functions that use this hook:

$timeout | int​

  • The number of seconds one Static Maps request can take before it's abandoned.
  • Values below 1 are treated as 1.
  • The default value is 5.

Usage​

Give each request 15 seconds:

add_filter( 'gfpdf_gv_static_map_timeout', function( $timeout ) {
return 15;
} );

Source Code​

This filter is located in src/Pdf/Maps/HttpClient.php of the PDF for GravityView extension.