Sets up the site query, based on the query vars passed.
$querystring|arrayoptional
site__in int[]site__not_in int[]count booldate_query arrayfields string'ids' (returns an array of site IDs) or empty (returns an array of complete site objects). ID intnumber intoffset intno_found_rows boolSQL_CALC_FOUND_ROWS query. Default true.orderby string|array'id''domain''path''network_id''last_updated''registered''domain_length''path_length''site__in''network__in''deleted''mature''spam''archived''public''none' to disable ORDER BY clause.'id'.order string'ASC', 'DESC'. Default 'ASC'.network_id intnetwork__in int[]network__not_in int[]domain stringdomain__in string[]domain__not_in string[]path stringpath__in string[]path__not_in string[]public intarchived intmature intspam intdeleted intlang_id intlang__in string[]lang__not_in string[]search stringsearch_columns string[]'domain' and 'path'.update_site_cache boolupdate_site_meta_cache boolmeta_key string|string[]meta_value string|string[]meta_compare stringmeta_compare_key stringmeta_type stringmeta_type_key stringmeta_query arrayDefault:''
public function __construct( $query = '' ) {
$this->query_var_defaults = array(
'fields' => '',
'ID' => '',
'site__in' => '',
'site__not_in' => '',
'number' => 100,
'offset' => '',
'no_found_rows' => true,
'orderby' => 'id',
'order' => 'ASC',
'network_id' => 0,
'network__in' => '',
'network__not_in' => '',
'domain' => '',
'domain__in' => '',
'domain__not_in' => '',
'path' => '',
'path__in' => '',
'path__not_in' => '',
'public' => null,
'archived' => null,
'mature' => null,
'spam' => null,
'deleted' => null,
'lang_id' => null,
'lang__in' => '',
'lang__not_in' => '',
'search' => '',
'search_columns' => array(),
'count' => false,
'date_query' => null, // See WP_Date_Query.
'update_site_cache' => true,
'update_site_meta_cache' => true,
'meta_query' => '',
'meta_key' => '',
'meta_value' => '',
'meta_type' => '',
'meta_compare' => '',
);
if ( ! empty( $query ) ) {
$this->query( $query );
}
}
| Version | Description |
|---|---|
| 5.3.0 | Introduced the 'meta_type_key' parameter. |
| 5.1.0 | Introduced the 'update_site_meta_cache', 'meta_query', 'meta_key', 'meta_compare_key', 'meta_value', 'meta_type', and 'meta_compare' parameters. |
| 4.8.0 | Introduced the 'lang_id', 'lang__in', and 'lang__not_in' parameters. |
| 4.6.0 | Introduced. |
© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_site_query/__construct