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 );
}

Changelog

Version Description
4.8.0 Introduced the 'lang_id', 'lang__in', and 'lang__not_in' parameters.
4.6.0 Introduced.

© 2003–2021 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/get_sites