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


The following would apply to all forms.

add_filter( 'gform_search_criteria_export_entries', 'your_function_name' );


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


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 );


This filter was added in Gravity Forms 2.7

Source Code

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


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?