The gform_getresponse_limit_pre_get_custom_fields filter allows you to override the maximum number of custom fields that are retrieved from GetResponse.
Usage
add_filter('gform_getresponse_limit_pre_get_custom_fields', 'your_function_name');
Parameters
- $limit (int): The custom fields limit. Defaults to 100.
More information
See Gravity Forms Docs: gform_getresponse_limit_pre_get_custom_fields
Examples
Modify the custom fields limit
This example demonstrates how to modify the custom fields limit to 200.
function increase_custom_fields_limit($limit) {
// Set the custom fields limit to 200
return 200;
}
add_filter('gform_getresponse_limit_pre_get_custom_fields', 'increase_custom_fields_limit');
Double the custom fields limit
This example doubles the custom fields limit.
function double_custom_fields_limit($limit) {
// Double the custom fields limit
return $limit * 2;
}
add_filter('gform_getresponse_limit_pre_get_custom_fields', 'double_custom_fields_limit');
Set a custom limit based on user role
This example sets a custom limit based on the user’s role.
function custom_limit_based_on_role($limit) {
// Check if the user is an administrator
if (current_user_can('administrator')) {
return 300;
} else {
return 100;
}
}
add_filter('gform_getresponse_limit_pre_get_custom_fields', 'custom_limit_based_on_role');
Remove the custom fields limit
This example removes the custom fields limit.
function remove_custom_fields_limit($limit) {
// Remove the custom fields limit
return -1;
}
add_filter('gform_getresponse_limit_pre_get_custom_fields', 'remove_custom_fields_limit');
Set the custom fields limit to a fixed number
This example sets the custom fields limit to a fixed number, such as 150.
function set_fixed_custom_fields_limit($limit) {
// Set the custom fields limit to 150
return 150;
}
add_filter('gform_getresponse_limit_pre_get_custom_fields', 'set_fixed_custom_fields_limit');