Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Get the ID of the Main Site in a WordPress Multisite Network
<?php
/*
* Get the ID of the main site in a multisite network
*
* @return int The blog_id of the main site
*/
function km_get_main_site_id() {
global $current_site;
return $current_site->blog_id;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.