Filter
rpress_api_stats_customers
On this page
Filters the customer statistics returned by the stats API endpoint.
Runs in RPRESS_API::get_stats() when the request type is 'customers'. The array contains 'customers' => 'total_customers', counted either from the legacy payment meta or from the customers table depending on whether the customer upgrade has completed. Use it to add further customer figures.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$stats | array | Customer statistics; $stats['customers']['total_customers'] holds the customer count. |
$this | RPRESS_API | The API instance handling the request. |
Return value#
array. The customer statistics to return.
Example#
function my_api_stats_customers( $stats, $api ) {
$stats['customers']['has_customers'] = ! empty( $stats['customers']['total_customers'] );
return $stats;
}
add_filter( 'rpress_api_stats_customers', 'my_api_stats_customers', 10, 2 );
Notes#
Fired from two branches of get_stats() with the same arguments.
Source#
Applied in:
includes/api/class-rpress-api.php(line 1140), inRPRESS_API::get_stats()includes/api/class-rpress-api.php(line 1144), inRPRESS_API::get_stats()
See also#
Was this page helpful?
