WP_Date_Query::get_compare( array $query ): string

In this article

Determines and validates what comparison operator to use.

Parameters

$queryarrayrequired
A date query or a date subquery.

Return

string The comparison operator.

Source

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

VersionDescription
3.7.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.