WordPress at a glance
function is not described

wp_get_sites() WP 3.7.0

Deprecated in 4.6.0. It is no longer supported and can be removed in future releases. Use get_sites() instead.

Return an array of sites for a network or networks.

  • See: get_sites()

No Hooks.

Return

Array. An empty array if the installation is considered "large" via wp_is_large_network(). Otherwise, an associative array of site data arrays, each containing the site (network) ID, blog ID, site domain and path, dates registered and modified, and the language ID. Also, boolean values for whether the site is public, archived, mature, spam, and/or deleted.

Usage

wp_get_sites( $args );
$args(array)

Array of default arguments. Optional.

  • $network_id (int/array)
    A network ID or array of network IDs. Set to null to retrieve sites from all networks.
    Default: current network ID

  • $public (int)
    Retrieve public or non-public sites.
    Default: null, for any

  • $archived (int)
    Retrieve archived or non-archived sites.
    Default: null, for any

  • $mature (int)
    Retrieve mature or non-mature sites.
    Default: null, for any

  • $spam (int)
    Retrieve spam or non-spam sites.
    Default: null, for any

  • $deleted (int)
    Retrieve deleted or non-deleted sites.
    Default: null, for any

  • $limit (int)
    Number of sites to limit the query to.
    Default: 100

  • $offset (int)
    Exclude the first x sites. Used in combination with the $limit parameter.

Default: array()

Code of wp get sites: wp-includes/ms-deprecated.php VER 5.1.1

<?php
function wp_get_sites( $args = array() ) {
	_deprecated_function( __FUNCTION__, '4.6.0', 'get_sites()' );

	if ( wp_is_large_network() )
		return array();

	$defaults = array(
		'network_id' => get_current_network_id(),
		'public'     => null,
		'archived'   => null,
		'mature'     => null,
		'spam'       => null,
		'deleted'    => null,
		'limit'      => 100,
		'offset'     => 0,
	);

	$args = wp_parse_args( $args, $defaults );

	// Backwards compatibility
	if( is_array( $args['network_id'] ) ){
		$args['network__in'] = $args['network_id'];
		$args['network_id'] = null;
	}

	if( is_numeric( $args['limit'] ) ){
		$args['number'] = $args['limit'];
		$args['limit'] = null;
	} elseif ( ! $args['limit'] ) {
		$args['number'] = 0;
		$args['limit'] = null;
	}

	// Make sure count is disabled.
	$args['count'] = false;

	$_sites  = get_sites( $args );

	$results = array();

	foreach ( $_sites as $_site ) {
		$_site = get_site( $_site );
		$results[] = $_site->to_array();
	}

	return $results;
}