CARVIEW |
Select Language
HTTP/2 200
date: Sat, 11 Oct 2025 20:20:17 GMT
content-type: text/html; charset=UTF-8
server: cloudflare
vary: Accept-Encoding
strict-transport-security: max-age=604800
strict-transport-security: max-age=31536000; includeSubDomains
x-content-type-options: nosniff
x-content-type-options: nosniff
x-xss-protection: 1; mode=block
x-xss-protection: 1; mode=block
x-frame-options: SAMEORIGIN
x-frame-options: SAMEORIGIN
referrer-policy: no-referrer
referrer-policy: strict-origin-when-cross-origin
link: ; rel="https://api.w.org/"
link: ; rel="alternate"; title="JSON"; type="application/json"
link: ; rel=shortlink
fastcgi-cache: HIT
report-to: {"group":"cf-nel","max_age":604800,"endpoints":[{"url":"https://a.nel.cloudflare.com/report/v4?s=mQ2rGI3hHAUVIWNAieLcX4jFazr%2BhB2HrmlOb8W20OHJCWRCaxY9tZ3xVuwnhgTk1F2xTKtxpfER9SiH%2BgHaGWnsAd%2FkNofzKznCZ662%2BXfgmgOm"}]}
cf-cache-status: DYNAMIC
nel: {"report_to":"cf-nel","success_fraction":0.0,"max_age":604800}
content-encoding: gzip
cf-ray: 98d10ea48953c197-BLR
gform_entries_filter_count_queries - Gravity Forms Documentation
gform_entries_filter_count_queries
The gform_entries_filter_count_queries
filter allows the queries used to get the counts for the entries list filter links to be overridden.
Usage
add_filter( 'gform_entries_filter_count_queries', 'your_function_name', 10, 2 );
Parameters
Parameter | Type | Description |
---|---|---|
$parameter | array | The filter count queries. |
$form_id | int | The ID of the form for which the queries are being prepared. |
The default value of $queries
:
$queries = array(
"COUNT(DISTINCT CASE WHEN l.status='active' THEN l.id END) as total",
"COUNT(DISTINCT CASE WHEN l.is_read=0 AND l.status='active' THEN l.id END) as unread",
"COUNT(DISTINCT CASE WHEN l.is_starred=1 AND l.status='active' THEN l.id END) as starred",
"COUNT(DISTINCT CASE WHEN l.status='spam' THEN l.id END) as spam",
"COUNT(DISTINCT CASE WHEN l.status='trash' THEN l.id END) as trash",
);
Examples
Add Custom Entry Count for Toxic Status.
add_filter( 'gform_entries_filter_count_queries', function ( $queries ) {
$queries[] = "COUNT(DISTINCT CASE WHEN l.status='toxic' THEN l.id END) as toxic";
return $queries;
} );
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?
Since
This filter was added in Gravity Forms 2.9.16
Source Code
This filter is located in GFFormsModel::get_form_counts()
in forms_model.php