WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru Платформа для конвертации и монетизации трафика
функция не описана

WP_Meta_Query::__construct() public WP 3.2.0

Constructor.

{} Это метод класса: WP_Meta_Query{}

Хуков нет.

Возвращает

Null. Ничего.

Использование

$WP_Meta_Query = new WP_Meta_Query();
$WP_Meta_Query->__construct( $meta_query );
$meta_query(массив)

Array of meta query clauses. When first-order clauses or sub-clauses use strings as their array keys, they may be referenced in the 'orderby' parameter of the parent query.

  • relation(строка)
    Optional. The MySQL keyword used to join the clauses of the query. Accepts 'AND', or 'OR'.
    По умолчанию: 'AND'

  • ...$0(массив)
    Optional. An array of first-order clause parameters, or another fully-formed meta query.

    • key(строка)
      Meta key to filter by.

    • compare_key(строка)
      MySQL operator used for comparing the $key. Accepts '=', '!=' 'LIKE', 'NOT LIKE', 'IN', 'NOT IN', 'REGEXP', 'NOT REGEXP', 'RLIKE', 'EXISTS' (alias of '=') or 'NOT EXISTS' (alias of '!='). when $key is an array, '=' otherwise.
      По умолчанию: 'IN'

    • type_key(строка)
      MySQL data type that the meta_key column will be CAST to for comparisons. Accepts 'BINARY' for case-sensitive regular expression comparisons.
      По умолчанию: ''

    • value(строка)
      Meta value to filter by.

    • compare(строка)
      MySQL operator used for comparing the $value. Accepts '=', '!=', '>', '>=', '<', '<=', 'LIKE', 'NOT LIKE', 'IN', 'NOT IN', 'BETWEEN', 'NOT BETWEEN', 'REGEXP', 'NOT REGEXP', 'RLIKE', 'EXISTS' or 'NOT EXISTS'. when $value is an array, '=' otherwise.
      По умолчанию: 'IN'

    • type(строка)
      MySQL data type that the meta_value column will be CAST to for comparisons. Accepts 'NUMERIC', 'BINARY', 'CHAR', 'DATE', 'DATETIME', 'DECIMAL', 'SIGNED', 'TIME', or 'UNSIGNED'.
      По умолчанию: 'CHAR'

По умолчанию: false

Список изменений

С версии 3.2.0 Введена.
С версии 4.2.0 Introduced support for naming query clauses by associative array keys.
С версии 5.1.0 Introduced $compare_key clause parameter, which enables LIKE key matches.
С версии 5.3.0 Increased the number of operators available to $compare_key. Introduced $type_key, which enables the $key to be cast to a new data type for comparisons.

Код WP_Meta_Query::__construct() WP 5.5.3

<?php
public function __construct( $meta_query = false ) {
	if ( ! $meta_query ) {
		return;
	}

	if ( isset( $meta_query['relation'] ) && 'OR' === strtoupper( $meta_query['relation'] ) ) {
		$this->relation = 'OR';
	} else {
		$this->relation = 'AND';
	}

	$this->queries = $this->sanitize_query( $meta_query );
}