WP_Tax_Query::__construct()
Constructor.
Метод класса: WP_Tax_Query{}
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
$WP_Tax_Query = new WP_Tax_Query(); $WP_Tax_Query->__construct( $tax_query );
- $tax_query(массив) (обязательный)
Array of taxonomy query clauses.
-
relation(строка)
Optional. The MySQL keyword used to join the clauses of the query. Accepts 'AND', or 'OR'.
По умолчанию: 'AND' -
...$0(массив)
An array of first-order clause parameters, or another fully-formed tax query.-
taxonomy(строка)
Taxonomy being queried. Optional when field=term_taxonomy_id. -
terms(строка|int|массив)
Term or terms to filter by. -
field(строка)
Field to match $terms against. Accepts 'term_id', 'slug', 'name', or 'term_taxonomy_id'.
По умолчанию: 'term_id' -
operator(строка)
MySQL operator to be used with $terms in the WHERE clause. Accepts 'AND', 'IN', 'NOT IN', 'EXISTS', 'NOT EXISTS'.
По умолчанию: 'IN' - include_children(true|false)
Optional. Whether to include child terms. Requires a $taxonomy.
По умолчанию: true
-
-
Список изменений
С версии 3.1.0 | Введена. |
С версии 4.1.0 | Added support for $operator 'NOT EXISTS' and 'EXISTS' values. |
Код WP_Tax_Query::__construct() WP Tax Query:: construct WP 6.7.1
public function __construct( $tax_query ) { if ( isset( $tax_query['relation'] ) ) { $this->relation = $this->sanitize_relation( $tax_query['relation'] ); } else { $this->relation = 'AND'; } $this->queries = $this->sanitize_query( $tax_query ); }