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

ParameterTypeDescription
$argsarrayArray of arguments that will be passed to GFAPI::get_entries() to fetch the entries to be displayed.
/**
 * @param array $args {
 *     Array of arguments that will be passed to GFAPI::get_entries() to fetch the entries to be displayed.
 *
 *     @type int   $form_id         The form ID for which entries will be loaded.
 *     @type array $search_criteria An array of search criteria that will be used to filter entries.
 *     @type array $sorting         An array containing properties that specify how the entries will be sorted.
 *     @type array $paging          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 a 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 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?

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.