Skip to content
Docs
Get RestroPress

Filter

rpress_category_earnings_graph_data

Updated
On this page

Filters the data plotted in the category earnings pie chart.

Runs when the Earnings by Category or Earnings by Add-on reports build their earnings pie chart. The array maps each label to its total earnings, sorted from highest to lowest, with child terms and zero-earnings rows left out.

Parameters#

ParameterTypeDescription
$dataarrayAssociative array of label => total earnings (number), sorted high to low.

Return value#

array. The filtered label => total earnings array.

Example#

function my_top_ten_earnings( $data ) {
	return array_slice( $data, 0, 10, true );
}
add_filter( 'rpress_category_earnings_graph_data', 'my_top_ten_earnings', 10, 1 );

Notes#

Fired from both the categories report table and the add-ons report table with the same arguments.

Source#

Applied in:

  • includes/admin/reporting/class-addons-reports-table.php (line 309), in RPRESS_Addons_Reports_Table::output_earnings_graph()
  • includes/admin/reporting/class-categories-reports-table.php (line 309), in RPRESS_Categories_Reports_Table::output_earnings_graph()

See also#

Was this page helpful?