Filter
rpress_payment_stats_post_statuses
On this page
Filters the payment statuses that the stats range queries count.
Used by RPRESS_Payment_Stats range methods to choose which statuses are included in SQL. The defaults are publish and revoked for earnings and taxes and refunded for the refunded totals. The status names are passed through sanitize_key, and an empty list falls back to a built-in default.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$statuses | string[] | List of payment statuses. |
Return value#
string[]. The statuses to include.
Example#
function my_stats_statuses( $statuses ) {
if ( in_array( 'publish', $statuses, true ) ) {
$statuses[] = 'processing';
}
return $statuses;
}
add_filter( 'rpress_payment_stats_post_statuses', 'my_stats_statuses' );
Notes#
Fired from four methods with different defaults: get_sales_by_range (publish, revoked), get_earnings_by_range (publish, revoked), get_refunded_by_range (refunded) and get_taxes_by_range (publish, revoked). In get_sales_by_range the filtered list is only a fallback, used when the status argument passed to the method is empty.
Source#
Applied in:
includes/payments/class-payment-stats.php(line 289), inRPRESS_Payment_Stats::get_sales_by_range()includes/payments/class-payment-stats.php(line 377), inRPRESS_Payment_Stats::get_earnings_by_range()includes/payments/class-payment-stats.php(line 481), inRPRESS_Payment_Stats::get_refunded_by_range()includes/payments/class-payment-stats.php(line 584), inRPRESS_Payment_Stats::get_taxes_by_range()
