Description
The gform_enable_download_nocache_headers
filter allows developers to disable the no-cache headers for file downloads. nocache_headers are enabled by default.
Usage
The following would apply to all forms.
add_filter( 'gform_enable_download_nocache_headers', 'your_function_name', 10, 3 );
To limit the scope of your function to a specific form, append the form id to the end of the hook name. (format: gform_enable_download_nocache_headers_FORMID).
add_filter( 'gform_enable_download_nocache_headers_123', 'your_function_name', 10, 3 );
Parameters
Parameter | Type | Description |
---|---|---|
$enable | bool | If the nocache_headers() should be called. |
$form_id | int | The ID of the form used to download files. |
$file | string | The file to be downloaded. |
Examples
Disable nocache headers for all file downloads.
add_filter( 'gform_enable_download_nocache_headers', '__return_false' );
Placement
This code can be used in the functions.php file of the active theme, a custom functions plugin, a custom add-on, or with a code snippets plugin.
See also the PHP section in this article: Where Do I Put This Code?
Since
Gravity Forms 2.9.15
Source Code
This filter is located in includes/class-gf-download.php