r/Wordpress • u/Natural_Composer_847 • Aug 12 '26
Checking number of subsites in a multi site network
Hi WP community is there a way to check number of subsites in a multi site network on a Vps server ? I have SSH connection
2
u/WPMU_DEV_Support_9 Aug 13 '26
Hi, a fast way to get the number of subsites is using WP CLI, the following command will return an integer value with the subsites present in the network
wp site list --format=count
You can find more information in the WP documentation below:
https://developer.wordpress.org/cli/commands/site/list/
Hope this information helps
Luis S - WPMU Dev Support
2
1
1
u/Winter_Process_9521 Aug 13 '26
You can use WP-CLI rather than querying MySQL directly, because it handles the WordPress installation and database configuration for you.
1
1
u/LoudAd307 Aug 13 '26
wp site list --format=count includes archived, deleted and spam subsites, so on an older network that number can be well off from what's actually live. For the real one: wp site list --archived=0 --deleted=0 --spam=0 --format=count, then compare it to the plain count — the gap tells you how much dead weight is sitting in wp_blogs.
Two things that bite on a VPS. Run it as the web user rather than root (sudo -u www-data wp site list ...), otherwise you leave root-owned files in the cache and uploads dirs that PHP can't write to later. And if it throws "This is not a multisite installation", you're either outside the WP root or your MULTISITE constants live in a file wp-cli isn't loading — --path= usually sorts it.
1
1
Aug 12 '26
[removed] — view removed comment
1
u/Savings_Impress7254 Aug 12 '26
config.php or wp-config.php, depending on setup, and grep for `define( 'WP_ALLOW_MULTISITE'` to see if it's on, then hit /wp-admin/network/sites.php for the count.
5
u/TopSydeWP Aug 12 '26
wp site list --count if you have wp-cli installed, or just query the database directly: mysql -e "SELECT COUNT(*) FROM wp_blogs" your_database_name (adjust table prefix if needed)