WP_Date_Query::get_sql_clauses()protectedWP 4.1.0

Generates SQL clauses to be appended to a main query.

Called by the public WP_Date_Query::get_sql(), this method is abstracted out to maintain parity with the other Query classes.

Method of the class: WP_Date_Query{}

No Hooks.

Return

String[]. Array containing JOIN and WHERE SQL clauses to append to the main query.

Usage

// protected - for code of main (parent) or child class
$result = $this->get_sql_clauses();

Changelog

Since 4.1.0 Introduced.

WP_Date_Query::get_sql_clauses() code WP 6.5.4

protected function get_sql_clauses() {
	$sql = $this->get_sql_for_query( $this->queries );

	if ( ! empty( $sql['where'] ) ) {
		$sql['where'] = ' AND ' . $sql['where'];
	}

	return $sql;
}