Description
The gform_filters_pre_results filter allows developers to modify the filters used in the drop down list of fields in the admin results page. The results page is currently only used by add-ons that implement the Add-On Framework.
Usage
add_filter( 'gform_filters_pre_results', 'your_function_name', 10, 2 );
Parameters
| Parameter | Type | Description |
|---|---|---|
$filter_settings | array | The array of filters. |
$form | Form Object | The form object. |
Examples
Remove payment related fields from the filters.
add_filter( 'gform_filters_pre_results', 'remove_payment_filters', 10, 2 );
function remove_payment_filters( $filter_settings, $form ) {
foreach ( $filter_settings as $i => $filter ) {
if ( in_array( $filter['key'], array( 'payment_amount', 'payment_date', 'payment_status', 'transaction_id' ) ) ) {
unset( $filter_settings[ $i ] );
}
}
return $filter_settings;
}
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?
Source Code
apply_filters( 'gform_filters_pre_results', $filter_settings, $form );
This filter is located in GFResults::results_page() in includes/addon/class-gf-results.php.