wp_count_sites

Advertisement

Summery Summery

Count number of sites grouped by site status.

Syntax Syntax

wp_count_sites( int $network_id = null )

Parameters Parameters

$network_id

(int) (Optional) The network to get counts for. Default is the current network ID.

Default value: null

Return Return

(int[]) Numbers of sites grouped by site status.

  • 'all'
    (int) The total number of sites.
  • 'public'
    (int) The number of public sites.
  • 'archived'
    (int) The number of archived sites.
  • 'mature'
    (int) The number of mature sites.
  • 'spam'
    (int) The number of spam sites.
  • 'deleted'
    (int) The number of deleted sites.

Source Source

File: wp-includes/ms-blogs.php

}

/**
 * Count number of sites grouped by site status.
 *
 * @since 5.3.0
 *
 * @param int $network_id Optional. The network to get counts for. Default is the current network ID.
 * @return int[] {
 *     Numbers of sites grouped by site status.
 *
 *     @type int $all      The total number of sites.
 *     @type int $public   The number of public sites.
 *     @type int $archived The number of archived sites.
 *     @type int $mature   The number of mature sites.
 *     @type int $spam     The number of spam sites.
 *     @type int $deleted  The number of deleted sites.
 * }
 */
function wp_count_sites( $network_id = null ) {
	if ( empty( $network_id ) ) {
		$network_id = get_current_network_id();
	}

	$counts = array();
	$args   = array(
		'network_id'    => $network_id,
		'number'        => 1,
		'fields'        => 'ids',

Advertisement

Changelog Changelog

Changelog
Version Description
5.3.0 Introduced.

Advertisement

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.