Using Gravity Forms ‘gform_entry_list_columns’ PHP filter

The gform_entry_list_columns filter in Gravity Forms allows you to change the columns set to be displayed on the Entry List page. This enables different columns to be displayed for each form.

Usage

To apply the filter to all forms:

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

To target a specific form, append the form id to the hook name (format: gform_entry_list_columns_FORMID):

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

Parameters

  • $table_columns (array) – The columns to be displayed in the entry list table.
  • $form_id (integer) – The ID of the form to which the entries being displayed belong.

More information

See Gravity Forms Docs: gform_entry_list_columns

Examples

Add Address City column to the entry list

This example adds the Address City column on the form to be displayed in the entry list.

add_filter('gform_entry_list_columns', 'set_columns', 10, 2);

function set_columns($table_columns, $form_id){
    $table_columns['field_id-3.3'] = 'City';
    return $table_columns;
}

Place this code in the functions.php file of your active theme.

Add a custom column for a specific form

This example adds a custom column “Phone” for form with ID 2.

add_filter('gform_entry_list_columns_2', 'add_phone_column', 10, 2);

function add_phone_column($table_columns, $form_id){
    $table_columns['field_id-4'] = 'Phone';
    return $table_columns;
}

Remove a column from the entry list

This example removes the “Date” column from the entry list.

add_filter('gform_entry_list_columns', 'remove_date_column', 10, 2);

function remove_date_column($table_columns, $form_id){
    unset($table_columns['date_created']);
    return $table_columns;
}

Rename a column in the entry list

This example renames the “IP” column to “IP Address”.

add_filter('gform_entry_list_columns', 'rename_ip_column', 10, 2);

function rename_ip_column($table_columns, $form_id){
    $table_columns['ip'] = 'IP Address';
    return $table_columns;
}

Reorder columns in the entry list

This example reorders the columns in the entry list, displaying the “Date” column first.

add_filter('gform_entry_list_columns', 'reorder_columns', 10, 2);

function reorder_columns($table_columns, $form_id){
    $new_columns = array('date_created' => $table_columns['date_created']);
    unset($table_columns['date_created']);
    return array_merge($new_columns, $table_columns);
}