Using Gravity Forms ‘gform_search_criteria_export_entries’ PHP filter

The gform_search_criteria_export_entries Gravity Forms filter allows you to modify the search criteria for entries when exporting them, including entries with different statuses like trash or abuse.

Usage

To use this filter in a general manner:

add_filter('gform_search_criteria_export_entries', 'your_function_name');

Parameters

  • $search_criteria (array): An array containing the search criteria.
  • $form_id (integer): The ID of the current form.

More information

See Gravity Forms Docs: gform_search_criteria_export_entries

This filter was added in Gravity Forms 2.7.

The filter is located in GFExport::start_export() in export.php.

Examples

Export active and trashed entries

This example exports both active entries and entries that have been moved to the trash:

add_filter('gform_search_criteria_export_entries', function($search_criteria) {
    $search_criteria['status'] = ['active', 'trash'];
    return $search_criteria;
});

Export spam entries for a specific form

This example exports entries marked as spam for form ID 12:

add_filter('gform_search_criteria_export_entries', function($search_criteria, $form_id) {
    if ($form_id == 12) {
        $search_criteria['status'] = ['spam'];
    }
    return $search_criteria;
}, 10, 2);