Uses
Uses | Description |
---|---|
wp-includes/class-wp-site-query.php: WP_Site_Query::__construct() | Sets up the site query, based on the query vars passed. |
Retrieves a list of sites matching requested arguments.
(string|array) (Optional) Array or query string of site query parameters.
(array) Array of site IDs to include.
(array) Array of site IDs to exclude.
(bool) Whether to return a site count (true) or array of site objects. Default false.
(array) Date query clauses to limit sites by. See WP_Date_Query. Default null.
(string) Site fields to return. Accepts 'ids' (returns an array of site IDs) or empty (returns an array of complete site objects).
(int) A site ID to only return that site.
(int) Maximum number of sites to retrieve. Default 100.
(int) Number of sites to offset the query. Used to build LIMIT clause. Default 0.
(bool) Whether to disable the SQL_CALC_FOUND_ROWS
query. Default true.
(string|array) Site status or array of statuses. Accepts 'id', 'domain', 'path', 'network_id', 'last_updated', 'registered', 'domain_length', 'path_length', 'site__in' and 'network__in'. Also accepts false, an empty array, or 'none' to disable ORDER BY
clause. Default 'id'.
(string) How to order retrieved sites. Accepts 'ASC', 'DESC'. Default 'ASC'.
(int) Limit results to those affiliated with a given network ID. If 0, include all networks. Default 0.
(array) Array of network IDs to include affiliated sites for.
(array) Array of network IDs to exclude affiliated sites for.
(string) Limit results to those affiliated with a given domain.
(array) Array of domains to include affiliated sites for.
(array) Array of domains to exclude affiliated sites for.
(string) Limit results to those affiliated with a given path.
(array) Array of paths to include affiliated sites for.
(array) Array of paths to exclude affiliated sites for.
(int) Limit results to public sites. Accepts '1' or '0'.
(int) Limit results to archived sites. Accepts '1' or '0'.
(int) Limit results to mature sites. Accepts '1' or '0'.
(int) Limit results to spam sites. Accepts '1' or '0'.
(int) Limit results to deleted sites. Accepts '1' or '0'.
(int) Limit results to a language ID.
(array) Array of language IDs to include affiliated sites for.
(array) Array of language IDs to exclude affiliated sites for.
(string) Search term(s) to retrieve matching sites for.
(array) Array of column names to be searched. Accepts 'domain' and 'path'.
(bool) Whether to prime the cache for found sites. Default true.
Default value: array()
(array|int) List of WP_Site objects, a list of site IDs when 'fields' is set to 'ids', or the number of sites when 'count' is passed as a query var.
File: wp-includes/ms-site.php
function get_sites( $args = array() ) { $query = new WP_Site_Query(); return $query->query( $args ); }
Version | Description |
---|---|
4.8.0 | Introduced the 'lang_id', 'lang__in', and 'lang__not_in' parameters. |
4.6.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/get_sites