get_sites() WordPress Function
The get_sites() function is used to retrieve a list of sites from a WordPress network. This function is only available to networks that are running WordPress 4.6 or higher.
get_sites( string|array $args = array() ) #
Retrieves a list of sites matching requested arguments.
Description
See also
Parameters
- $args
(string|array)(Optional) Array or string of arguments. See WP_Site_Query::__construct() for information on accepted arguments.
Default value: array()
Return
(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.
Source
File: wp-includes/ms-site.php
function get_sites( $args = array() ) { $query = new WP_Site_Query(); return $query->query( $args ); }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
4.8.0 | Introduced the 'lang_id', 'lang__in', and 'lang__not_in' parameters. |
4.6.0 | Introduced. |