Filter
rpress_service_date_raw
On this page
Filters the raw service date before it is used for store-open checks.
Runs in rp_row_date(), which rpress_is_store_open() uses to normalise a selected date. If the filtered value is empty, today's date (Y-m-d, site timezone) is used instead. The expected format is Y-m-d.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$raw_date | string | Service date as received, normally Y-m-d. |
$service_type | string | Service type the date is for. |
Return value#
string. Date string in Y-m-d format, or an empty string to use today.
Example#
function my_normalise_service_date( $raw_date, $service_type ) {
$timestamp = strtotime( $raw_date );
return $timestamp ? gmdate( 'Y-m-d', $timestamp ) : $raw_date;
}
add_filter( 'rpress_service_date_raw', 'my_normalise_service_date', 10, 2 );
Source#
Applied in:
includes/rp-core-functions.php(line 3160), inrp_row_date()
See also#
Was this page helpful?
