gform_get_entries_args_entry_list

Description

The gform_get_entries_args_entry_list filter is executed immediately before entries are fetched for display in the Entry List view. It provides the ability to filter all arguments that are passed to the GFAPI::get_entries() method thereby allowing you to filter which entries are displayed in the Entry List.

Usage

The following would apply to all forms.

add_filter( 'gform_get_entries_args_entry_list', 'your_function_name', 10, 2 );

The following would apply to only to form ID 1.

add_filter( 'gform_get_entries_args_entry_list_1', 'your_function_name', 10, 2 );

Parameters

  • $args array

    Array of arguments that will be passed to GFAPI::get_entries() to fetch the entries to be displayed.

    • $form_id int

      The form ID for which entries will be loaded.

    • $search_criteria array

      An array of search critiera that will be used to filter entries.

    • $sorting array

      An array containing properties that specify how the entries will be sorted.

    • $paging array

      An array containing properties that specify how the entries will be paginated.

Examples

Filter Entry List by Entry Meta

This example demonstrates how you could pass parameter in the query string for a custom meta key and only show entries that match the specified value.

add_filter( 'gform_get_entries_args_entry_list', function( $args ) {

	$meta_key   = 'my_meta_key';
	$meta_value = rgget( $meta_key );
	if( ! $meta_value ) {
		return $args;
	}

	if( ! isset( $args['search_criteria']['field_filters'] ) ) {
		$args['search_criteria']['field_filters'] = array();
	}

	$args['search_criteria']['field_filters'][] = array(
		'key'   => $meta_key,
		'value' => $meta_value
	);

	return $args;
} );

Placement

This code should be placed in the functions.php file of your active theme.

Since

This filter was added in Gravity Forms 2.2.3.4.

Source Code

This filter is located in GF_Entry_List_Table::prepare_items() in entry_list.php.