get_blog_count() WordPress Function

The get_blog_count() function in WordPress returns the number of blogs associated with a user. This function is useful for multisite installations.

get_blog_count( int|null $network_id = null ) #

Gets the number of active sites on the installation.


Description

The count is cached and updated twice daily. This is not a live count.


Top ↑

Parameters

$network_id

(int|null)(Optional)ID of the network. Default is the current network.

Default value: null


Top ↑

Return

(int) Number of active sites on the network.


Top ↑

Source

File: wp-includes/ms-functions.php

function get_blog_count( $network_id = null ) {
	return get_network_option( $network_id, 'blog_count' );
}


Top ↑

Changelog

Changelog
VersionDescription
MU (3.0.0)MU (3.0.0)
4.8.0The $network_id parameter is now being used.
3.7.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More
Show More