Skip to content
Docs
Get RestroPress

Filter

rpress_stats_date

Updated
On this page

Filters a date after it has been converted to a timestamp.

Applied at the end of RPRESS_Stats::convert_date() for both start and end dates. The value is a Unix timestamp built with mktime() for predefined and string dates, or the unchanged numeric value for timestamps. The end flag tells whether the end of the period is being calculated.

Parameters#

ParameterTypeDescription
$dateintConverted timestamp.
$end_dateboolTrue when converting an end date.
$statsRPRESS_StatsThe stats object.

Return value#

int. The timestamp.

Example#

function my_stats_date( $date, $end_date, $stats ) {
	return $date;
}
add_filter( 'rpress_stats_date', 'my_stats_date', 10, 3 );

Notes#

Invalid dates return a WP_Error earlier, before this filter runs.

Source#

Applied in:

  • includes/class-rpress-stats.php (line 329), in RPRESS_Stats::convert_date()

See also#

Was this page helpful?