get_blogaddress_by_name

Advertisement

Summery Summery

Get a full blog URL, given a blog name.

Syntax Syntax

get_blogaddress_by_name( string $blogname )

Parameters Parameters

$blogname

(Required) The (subdomain or directory) name

Return Return

(string)

Source Source

File: wp-includes/ms-blogs.php

function get_blogaddress_by_name( $blogname ) {
	if ( is_subdomain_install() ) {
		if ( 'main' === $blogname ) {
			$blogname = 'www';
		}
		$url = rtrim( network_home_url(), '/' );
		if ( ! empty( $blogname ) ) {
			$url = preg_replace( '|^([^\.]+://)|', '${1}' . $blogname . '.', $url );
		}
	} else {
		$url = network_home_url( $blogname );
	}
	return esc_url( $url . '/' );
}

Advertisement

Changelog Changelog

Changelog
Version Description
MU (3.0.0) Introduced.

Advertisement

Leave a Reply