gform_search_criteria_export_entries

Description

Use this filter to allow entries of different statuses (i.e. trash, abuse) to be exported.

Usage

The following would apply to all forms.

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.

Examples

Entries that are active and those moved to the trash

The following example shows how to export 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;
} );

Entries that are marked spam for one form only

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

Since

This filter was added in Gravity Forms 2.7

Source Code

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

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?