WP_Date_Query::is_first_order_clause() WordPress Method

The WP_Date_Query::is_first_order_clause() method is used to check whether the date query clause is the first order clause in the query. This is useful for checking whether the date query should be added as an ORDER BY clause or not. This method takes a single parameter, which is the order clause to check. The method returns a boolean value of true if the clause is the first order clause, or false if it is not.

WP_Date_Query::is_first_order_clause( array $query ) #

Determine whether this is a first-order clause.


Description

Checks to see if the current clause has any time-related keys. If so, it’s first-order.


Top ↑

Parameters

$query

(array)(Required)Query clause.


Top ↑

Return

(bool) True if this is a first-order clause.


Top ↑

Source

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

	protected function is_first_order_clause( $query ) {
		$time_keys = array_intersect( $this->time_keys, array_keys( $query ) );
		return ! empty( $time_keys );
	}


Top ↑

Changelog

Changelog
VersionDescription
4.1.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.