The gform_form_export_filename filter in Gravity Forms allows you to change the default form export filename.
Usage
add_filter('gform_form_export_filename', 'your_function_name', 10, 1);
Parameters
$filename
(string): The new filename to use for the export file. Do not include a file extension, as “.json” is added automatically.
More information
See Gravity Forms Docs: gform_form_export_filename
Place this code in the functions.php
file of your active theme.
This filter was added in Gravity Forms version 2.3.4.
Examples
Change export filename to custom name
Change the export filename to ‘custom_export_name’.
add_filter('gform_form_export_filename', function($filename) { return 'custom_export_name'; });
Add date to export filename
Add the current date to the export filename.
add_filter('gform_form_export_filename', function($filename) { return 'export_' . date('Y_m_d'); });
Include form ID in export filename
Include the form ID in the export filename.
add_filter('gform_form_export_filename', function($filename) { $form_id = rgget('id'); return 'form_' . $form_id . '_export'; });
Use custom export filename based on user role
Change the export filename based on the user role.
add_filter('gform_form_export_filename', function($filename) { $user = wp_get_current_user(); if (in_array('administrator', $user->roles)) { return 'admin_export'; } else { return 'non_admin_export'; } });
Add site name to export filename
Add the site name to the export filename.
add_filter('gform_form_export_filename', function($filename) { $site_name = get_bloginfo('name'); return 'export_' . sanitize_title($site_name); });