WP_Date_Query::get_compare() public WP 3.7.0
Determines and validates what comparison operator to use.
{} It's a 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. |
Code of WP_Date_Query::get_compare() WP Date Query::get compare WP 5.6
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;
}