WP_Date_Query::is_first_order_clause() WordPress Method
The WP_Date_Query::is_first_order_clause() method is used to check whether the date query clause is the first order clause in the query. This is useful for checking whether the date query should be added as an ORDER BY clause or not. This method takes a single parameter, which is the order clause to check. The method returns a boolean value of true if the clause is the first order clause, or false if it is not.
WP_Date_Query::is_first_order_clause( array $query ) #
Determine whether this is a first-order clause.
Description
Checks to see if the current clause has any time-related keys. If so, it’s first-order.
Parameters
- $query
(array)(Required)Query clause.
Return
(bool) True if this is a first-order clause.
Source
File: wp-includes/class-wp-date-query.php
protected function is_first_order_clause( $query ) { $time_keys = array_intersect( $this->time_keys, array_keys( $query ) ); return ! empty( $time_keys ); }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
4.1.0 | Introduced. |