WP_Date_Query::get_compare() WordPress Method

The WP_Date_Query::get_compare() method is used to get the comparison operator for a given date query.

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.


Top ↑

Return

(string) The comparison operator.


Top ↑

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


Top ↑

Changelog

Changelog
VersionDescription
3.7.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.