W3cubDocs

/WordPress

WP_Date_Query::get_compare( array $query )

Determines and validates what comparison operator to use.

Parameters

$query

(array) (Required) A date query or a date subquery.

Return

(string) The comparison operator.

Source

File: wp-includes/class-wp-date-query.php

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;
	}

Changelog

Version Description
3.7.0 Introduced.

© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_date_query/get_compare