wpseek.com
A WordPress-centric search engine for devs and theme authors



get_blogaddress_by_name › WordPress Function

Since
Deprecatedn/a
get_blogaddress_by_name ( $blogname )
Parameters:
  • (string) $blogname Name of the subdomain or directory.
    Required: Yes
Returns:
  • (string)
Defined at:
Codex:
Change Log:
  • MU

Gets a full site URL, given a site name.



Source

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 . '/' );
}