Instead of get_site_url()
, use get_home_url()
. This will return the URL of the site you’re in.
You can also get the URL of a different site in your Multisite network by passing that site’s blog_id
(ie, $url = get_home_url( 2 );
).
(I suspect that get_site_url()
is a holdover from the early days of Multisite; when Multisite was originally moved into WordPress, you created a site of blogs. The terminology has evolved, so that we now think of a network of sites, but some of the functions still reflect the old terms.)