Description
The gform_rest_api_retrieve_form_totals filter allows the entries property (entry totals) to be omitted from the GET /forms (REST API v2) response. This is useful for increasing performance of the endpoint when totals aren’t required.
Usage
The filter would be used like so:
add_filter( 'gform_rest_api_retrieve_form_totals', 'your_function_name', 10, 2 );
You can also specify this per form by adding the form id after the filter name.
add_filter( 'gform_rest_api_retrieve_form_totals_6', 'your_function_name', 10, 2 );
Parameters
Examples
1. Simple Usage
add_filter( 'gform_rest_api_retrieve_form_totals', '__return_false' );
2. Advanced Usage
add_filter( 'gform_rest_api_retrieve_form_totals', function ( $include_totals, $form ) { return ! in_array( $form->id, array( 1, 3, 5 ) ); }, 10, 2 );
Placement
This code should be placed in the functions.php file of your active theme or a custom functions plugin.
Since
This filter was added in Gravity Forms v2.4.24.1.
Source Code
This filter is located in GF_REST_Forms_Controller::get_items in includes/webapi/v2/includes/controllers/class-controller-forms.php.