WP_Date_Query::get_compare()
Determines and validates what comparison operator to use.
Method of the class: WP_Date_Query{}
No Hooks.
Return
String
. The comparison operator.
Usage
$WP_Date_Query = new WP_Date_Query(); $WP_Date_Query->get_compare( $query );
- $query(array) (required)
- A date query or a date subquery.
Changelog
Since 3.7.0 | Introduced. |
WP_Date_Query::get_compare() WP Date Query::get compare code WP 6.5.2
public function get_compare( $query ) { if ( ! empty( $query['compare'] ) && in_array( $query['compare'], array( '=', '!=', '>', '>=', '<', '<=', 'IN', 'NOT IN', 'BETWEEN', 'NOT BETWEEN' ), true ) ) { return strtoupper( $query['compare'] ); } return $this->compare; }