<?php /** * Site API: WP_Site_Query class * * @package WordPress * @subpackage Sites * @since 4.6.0 */ /** * Core class used for querying sites. * * @since 4.6.0 * * @see WP_Site_Query::__construct() for accepted arguments. */ #[AllowDynamicProperties] class WP_Site_Query { /** * SQL for database query. * * @since 4.6.0 * @var string */ public $request; /** * SQL query clauses. * * @since 4.6.0 * @var array */ protected $sql_clauses = array( 'select' => '', 'from' => '', 'where' => array(), 'groupby' => '', 'orderby' => '', 'limits' => '', ); /** * Metadata query container. * * @since 5.1.0 * @var WP_Meta_Query */ public $meta_query = false; /** * Metadata query clauses. * * @since 5.1.0 * @var array */ protected $meta_query_clauses; /** * Date query container. * * @since 4.6.0 * @var WP_Date_Query A date query instance. */ public $date_query = false; /** * Query vars set by the user. * * @since 4.6.0 * @var array */ public $query_vars; /** * Default values for query vars. * * @since 4.6.0 * @var array */ public $query_var_defaults; /** * List of sites located by the query. * * @since 4.6.0 * @var array */ public $sites; /** * The amount of found sites for the current query. * * @since 4.6.0 * @var int */ public $found_sites = 0; /** * The number of pages. * * @since 4.6.0 * @var int */ public $max_num_pages = 0; /** * Sets up the site query, based on the query vars passed. * * @since 4.6.0 * @since 4.8.0 Introduced the 'lang_id', 'lang__in', and 'lang__not_in' parameters. * @since 5.1.0 Introduced the 'update_site_meta_cache', 'meta_query', 'meta_key', * 'meta_compare_key', 'meta_value', 'meta_type', and 'meta_compare' parameters. * @since 5.3.0 Introduced the 'meta_type_key' parameter. * * @param string|array $query { * Optional. Array or query string of site query parameters. Default empty. * * @type int[] $site__in Array of site IDs to include. Default empty. * @type int[] $site__not_in Array of site IDs to exclude. Default empty. * @type bool $count Whether to return a site count (true) or array of site objects. * Default false. * @type array $date_query Date query clauses to limit sites by. See WP_Date_Query. * Default null. * @type string $fields Site fields to return. Accepts 'ids' (returns an array of site IDs) * or empty (returns an array of complete site objects). Default empty. * @type int $ID A site ID to only return that site. Default empty. * @type int $number Maximum number of sites to retrieve. Default 100. * @type int $offset Number of sites to offset the query. Used to build LIMIT clause. * Default 0. * @type bool $no_found_rows Whether to disable the `SQL_CALC_FOUND_ROWS` query. Default true. * @type string|array $orderby Site status or array of statuses. Accepts: * - 'id' * - 'domain' * - 'path' * - 'network_id' * - 'last_updated' * - 'registered' * - 'domain_length' * - 'path_length' * - 'site__in' *