A WordPress-centric search engine for devs and theme authors



get_blogaddress_by_name ›

Since3.0.0
Deprecatedn/a
get_blogaddress_by_name ( $blogname )
Parameters:
  • (string) $blogname The (subdomain or directory) name
    Required: Yes
Returns:
  • (string)
Defined at:
Codex:
Change Log:
  • MU

Get a full blog URL, given a blog name.



Source

function get_blogaddress_by_name( $blogname ) {
	if ( is_subdomain_install() ) {
		if ( $blogname == 'main' ) {
			$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 . '/' );
}