Function: network_site_url

network_site_url( string $path, string $scheme )

Retrieves the site URL for the current network.

Returns the site URL with the appropriate protocol, 'https' if is_ssl() and 'http' otherwise. If $scheme is 'http' or 'https', is_ssl() is overridden.

Parameters

Name Type(s) Default Value Description
$path string ''

Optional. Path relative to the site URL. Default empty.

$scheme string null

Optional. Scheme to give the site URL context. Accepts 'http', 'https', or 'relative'. Default null.

Returns

string

Site URL link with optional path appended.

WordPress Developer Newsletter

Stay on top of the latest WordPress API changes, developer tool updates, security alerts and more.