Tribe__Events__Service_Providers__ORM::maybe_remove_date_meta_queries( array $args = array(), WP_Query|null $query = null )
Handles next and previous links arguments when generated on a repository-managed query.
Contents
The next and previous links are built by using the global query arguments and slightly altering them. This approach, when done on the arguments provided by a repository generated query, might yield duplicated meta queries that will, in turn, return wrong results. The arguments will be already set in the arguments of the query.
Parameters
- $args
-
(array) (Optional) An array of query arguments that will be used to check if there are next or previous events.
Default value: array()
- $query
-
(WP_Query|null) (Optional) The query the arguments were taken from.
Default value: null
Return
(array) A filtered array of arguments where the date-related contents of the meta query are removed to avoid duplicates.
Source
File: src/Tribe/Service_Providers/ORM.php
public function maybe_remove_date_meta_queries( array $args = [], WP_Query $query = null ) {
if ( empty( $args['meta_query'] ) || ! $query instanceof WP_Query ) {
return $args;
}
if ( empty( $query->builder ) || ! $query->builder instanceof Tribe__Repository__Interface ) {
return $args;
}
$args['meta_query'] = tribe_filter_meta_query(
$args['meta_query'],
[ 'key' => '/_Event(Start|End)Date(UTC)*/' ]
);
return $args;
}
Changelog
| Version | Description |
|---|---|
| 4.9 | Introduced. |