gppa_query_limit
Description
Adjust the maximum number of results that can be returned in a GP Populate Anything query.
Usage
Apply to all applicable fields on all forms.
add_filter( 'gppa_query_limit', 'my_custom_function' );
Apply to all applicable fields on a specific form.
add_filter( 'gppa_query_limit_FORMID', 'my_custom_function' );
Apply to a specific field on a specific form.
add_filter( 'gppa_query_limit_FORMID_FIELDID', 'my_custom_function' );
Parameters
query_limit int
Query limit to be passed onto Object Type queries.
object_type GPPA_Object_Type
Current object type.
field GF_Field
The current field being populated.
Since
This filter is available since GP Populate Anything 1.0.
The $field
parameter and FORMID/FIELDID support was added in 1.0-beta-4.44.
Examples
Change the query limit to 750 for all dynamically populated fields.
<?php
/**
* Gravity Perks // GP Populate Anything // Change The Query Limit
* https://gravitywiz.com/documentation/gravity-forms-populate-anything/
*/
add_filter( 'gppa_query_limit', function() {
// Update "750" to whatever you would like the query limit to be.
return 750;
} );
Change the query limit to 750 for only the post object type.
<?php
/**
* Gravity Perks // Populate Anything // Change Query Limit for a Specific Object Type
* https://gravitywiz.com/documentation/gravity-forms-populate-anything/
*/
add_filter( 'gppa_query_limit', function( $query_limit, $object_type ) {
// Update "post" to your the object for which you would like to increase the limit.
if ( $object_type->id === 'post' ) {
// Update "750" to the number of results to return for this object type.
$query_limit = 750;
}
return $query_limit;
}, 10, 2 );
Change the query limit to 1000 for a specific field on a form.
In this example, we increase the query limit to 1,000 for field 4
in form 123
.
<?php
/**
* Gravity Perks // GP Populate Anything // Change Query Limit for a Specific Field
* https://gravitywiz.com/documentation/gravity-forms-populate-anything/
*/
// Update "123" to your form ID and "4" to your field ID.
add_filter( 'gppa_query_limit_123_4', function( $query_limit, $object_type ) {
// Update "1000" to the maximum number of results that should be returned for the query populating this field.
return 1000;
}, 10, 2 );