Skip to content
Docs
Get RestroPress

Filter

rpress_payment_stats_post_statuses

Updated
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#

ParameterTypeDescription
$statusesstring[]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), in RPRESS_Payment_Stats::get_sales_by_range()
  • includes/payments/class-payment-stats.php (line 377), in RPRESS_Payment_Stats::get_earnings_by_range()
  • includes/payments/class-payment-stats.php (line 481), in RPRESS_Payment_Stats::get_refunded_by_range()
  • includes/payments/class-payment-stats.php (line 584), in RPRESS_Payment_Stats::get_taxes_by_range()

See also#

Was this page helpful?