WordPress at Your Fingertips
function is not described

WP_Tax_Query::get_sql_clauses() protected WP 4.1.0

Generate SQL clauses to be appended to a main query.

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

{} It's a method of the class: WP_Tax_Query{}

No Hooks.


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


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


Since 4.1.0 Introduced.

Code of WP_Tax_Query::get_sql_clauses() WP 5.8.2

protected function get_sql_clauses() {
	 * $queries are passed by reference to get_sql_for_query() for recursion.
	 * To keep $this->queries unaltered, pass a copy.
	$queries = $this->queries;
	$sql     = $this->get_sql_for_query( $queries );

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

	return $sql;