Tribe__Events__Repositories__Event::filter_by_ends_before( string|DateTime|int $datetime, string|DateTimeZone $timezone = null )
Filters events whose end date occurs before the provided date; fetch is inclusive.
Contents
Parameters
- $datetime
-
(string|DateTime|int) (Required) A
strtotime
parse-able string, a DateTime object or a timestamp. - $timezone
-
(string|DateTimeZone) (Optional) A timezone string, UTC offset or DateTimeZone object; defaults to the site timezone; this parameter is ignored if the
$datetime
parameter is a DatTime object.Default value: null
Return
(array) An array of arguments that should be added to the WP_Query object.
Source
File: src/Tribe/Repositories/Event.php
public function filter_by_ends_before( $datetime, $timezone = null ) { $date = Tribe__Date_Utils::build_date_object( $datetime, $timezone ) ->setTimezone( $this->normal_timezone ); return [ 'meta_query' => [ 'ends-before' => [ 'key' => $this->end_meta_key, 'compare' => '<', 'value' => $date->format( Tribe__Date_Utils::DBDATETIMEFORMAT ), 'type' => 'DATETIME', ], ], ]; }
Changelog
Version | Description |
---|---|
4.9 | Introduced. |