Skip to content

Instantly share code, notes, and snippets.

@ShaneGowland
Last active December 15, 2015 18:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ShaneGowland/5307453 to your computer and use it in GitHub Desktop.
Save ShaneGowland/5307453 to your computer and use it in GitHub Desktop.
Allows you to display the total number of sites on a WordPress Network. Pluginified.
function get_site_count(){
global $wpdb;
$id = 0;
$site_count = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM wp_blogs WHERE deleted = %d",$id));
return $site_count;
}
//register the shortcode
add_shortcode('sitecount', 'get_site_count');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment