The gform_search_criteria_entry_limit_validation Gravity Forms PHP filter can be used to modify the search criteria used to get the current entry count for the entry limit validation.
Usage
A generic example of how to use the filter:
add_filter('gform_search_criteria_entry_limit_validation', 'your_function_name', 10, 2);
To limit the scope of your function to a specific form, append the form ID to the end of the hook name (format: gform_search_criteria_entry_limit_validation_FORMID
):
add_filter('gform_search_criteria_entry_limit_validation_6', 'your_function_name', 10, 2);
Parameters
- $search_criteria (array): An array containing the search criteria. See Search Arguments for accepted arguments.
Example of
$search_criteria
:$search_criteria = array( 'status' => 'active', 'start_date' => '2023-02-01', 'end_date' => '2023-02-01 23:59:59', );
- $form (Form Object): The form currently being validated.
More information
See Gravity Forms Docs: gform_search_criteria_entry_limit_validation
Examples
Add field filter
This example shows how you can filter the entries used for the limit count by a field or entry meta value:
add_filter('gform_search_criteria_entry_limit_validation', function($search_criteria, $form) { $search_criteria['field_filters'][] = array('key' => 'partial_entry_id', 'value' => ''); return $search_criteria; }, 10, 2);