Skip to content
Docs
Get RestroPress

Filter

rpress_api_stat_dates

Updated
On this page

Filters the date values used to retrieve earnings and sales in the API.

Runs at the end of get_dates after the requested date range has been resolved. The array contains values such as day, day_end, m_start, m_end, year and year_end, depending on the requested range, and is used to build the stats queries.

Parameters#

ParameterTypeDescription
$datesarrayThe date parts used for retrieving earnings and sales.

Return value#

array. The date parts.

Example#

function my_api_stat_dates( $dates ) {
	if ( empty( $dates['year'] ) ) {
		$dates['year'] = gmdate( 'Y' );
	}
	return $dates;
}
add_filter( 'rpress_api_stat_dates', 'my_api_stat_dates' );

Source#

Applied in:

  • includes/api/class-rpress-api.php (line 759), in RPRESS_API::get_dates()
  • includes/class-rpress-api.php (line 517), in RPRESS_API::get_dates()

See also#

Was this page helpful?