Retrieve the home url for a given site.

Returns the ‘home’ option with the appropriate protocol, ‘https’ if is_ssl() and ‘http’ otherwise. If $scheme is ‘http’ or ‘https’, is_ssl() is overridden.

Signature

get_home_url( $blog_id = null, $path = '', $scheme = null )
blog_id
 (int) (optional) Blog ID. Defaults to current blog.
Default: null
path
 (string) (optional) Path relative to the home url.
Default: ''
scheme
 (string) (optional) Scheme to give the home url context. Currently 'http', 'https', or 'relative'.
Default: null

Return

(string) Home url link with optional path appended.

Source

function get_home_url( $blog_id = null, $path = '', $scheme = null ) {
	$orig_scheme = $scheme;

	if ( empty( $blog_id ) || !is_multisite() ) {
		$url = get_option( 'home' );
	} else {
		switch_to_blog( $blog_id );
		$url = get_option( 'home' );
		restore_current_blog();
	}

	if ( ! in_array( $scheme, array( 'http', 'https', 'relative' ) ) ) {
		if ( is_ssl() && ! is_admin() && 'wp-login.php' !== $GLOBALS['pagenow'] )
			$scheme = 'https';
		else
			$scheme = parse_url( $url, PHP_URL_SCHEME );
	}

	$url = set_url_scheme( $url, $scheme );

15 more lines...
WP Trac GitHub

Link here