WP_Network_Query::__construct()publicWP 4.6.0

Constructor.

Sets up the network query, based on the query vars passed.

Метод класса: WP_Network_Query{}

Хуков нет.

Возвращает

null. Ничего (null).

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

$WP_Network_Query = new WP_Network_Query();
$WP_Network_Query->__construct( $query );
$query(строка|массив)

Array or query string of network query parameters.

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

  • network__in(int[])
    Array of network IDs to include.
    По умолчанию: ''

  • network__not_in(int[])
    Array of network IDs to exclude.
    По умолчанию: ''

  • count(true|false)
    Whether to return a network count (true) or array of network objects.
    По умолчанию: false

  • fields(строка)
    Network fields to return. Accepts 'ids' (returns an array of network IDs) or empty (returns an array of complete network objects).
    По умолчанию: ''

  • number(int)
    Maximum number of networks to retrieve.
    По умолчанию: empty (no limit)

  • offset(int)
    Number of networks to offset the query. Used to build LIMIT clause.

  • no_found_rows(true|false)
    Whether to disable the SQL_CALC_FOUND_ROWS query.
    По умолчанию: true

  • orderby(строка|массив)
    Network status or array of statuses. Accepts 'id', 'domain', 'path', 'domain_length', 'path_length' and 'network__in'. Also accepts false, an empty array, or 'none' to disable ORDER BY clause.
    По умолчанию: 'id'

  • order(строка)
    How to order retrieved networks. Accepts 'ASC', 'DESC'.
    По умолчанию: 'ASC'

  • domain(строка)
    Limit results to those affiliated with a given domain.
    По умолчанию: ''

  • domain__in(string[])
    Array of domains to include affiliated networks for.
    По умолчанию: ''

  • domain__not_in(string[])
    Array of domains to exclude affiliated networks for.
    По умолчанию: ''

  • path(строка)
    Limit results to those affiliated with a given path.
    По умолчанию: ''

  • path__in(string[])
    Array of paths to include affiliated networks for.
    По умолчанию: ''

  • path__not_in(string[])
    Array of paths to exclude affiliated networks for.
    По умолчанию: ''

  • search(строка)
    Search term(s) to retrieve matching networks for.
    По умолчанию: ''

  • update_network_cache(true|false)
    Whether to prime the cache for found networks.
    По умолчанию: true

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

С версии 4.6.0 Введена.

Код WP_Network_Query::__construct() WP 6.4.3

public function __construct( $query = '' ) {
	$this->query_var_defaults = array(
		'network__in'          => '',
		'network__not_in'      => '',
		'count'                => false,
		'fields'               => '',
		'number'               => '',
		'offset'               => '',
		'no_found_rows'        => true,
		'orderby'              => 'id',
		'order'                => 'ASC',
		'domain'               => '',
		'domain__in'           => '',
		'domain__not_in'       => '',
		'path'                 => '',
		'path__in'             => '',
		'path__not_in'         => '',
		'search'               => '',
		'update_network_cache' => true,
	);

	if ( ! empty( $query ) ) {
		$this->query( $query );
	}
}