WordPress.org

Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

WPMU Functions/get sitestats

Description

Returns an array containing the number of blogs and users registered on this WPMU site, including blogs which are currently marked not public. Useful for displaying general site statistics.

Parameters

None.

Return values

(array) 
Associative array containing the following:
blogs 
(integer) The number of active blogs hosted by this WPMU install.
users 
(integer) The number of users registered on this WPMU install.

Usage

As this function returns values, you should assign the return value to a variable and access the desired array elements.

<?php $site_stats get_sitestats(); ?>

Examples

Stats sidebar

(Devportals) You can post stats in your sidebar by pasting the following snippet into your theme's sidebar.php: <?php
  $stats 
get_sitestats();
  echo 
'There are currently '.$stats'blogs' ].' blogs running on this server and '.$stats'users' ].' users.';
?>