On this page
WP_Meta_Query::get_sql_clauses(): string[]
Generate SQL clauses to be appended to a main query.
Description
Called by the public WP_Meta_Query::get_sql(), this method is abstracted out to maintain parity with the other Query classes.
Return
string[] Array containing JOIN and WHERE SQL clauses to append to the main query.
joinstringSQL fragment to append to the main JOIN clause.wherestringSQL fragment to append to the main WHERE clause.
Source
File: wp-includes/class-wp-meta-query.php. View all references
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;
}
Related
Uses
| Uses | Description |
|---|---|
| WP_Meta_Query::get_sql_for_query() wp-includes/class-wp-meta-query.php | Generate SQL clauses for a single query array. |
Used By
| Used By | Description |
|---|---|
| WP_Meta_Query::get_sql() wp-includes/class-wp-meta-query.php | Generates SQL clauses to be appended to a main query. |
Changelog
| Version | Description |
|---|---|
| 4.1.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_meta_query/get_sql_clauses