get_blogaddress_by_name

Definition:
function get_blogaddress_by_name( $blogname ) {}

Get a full blog URL, given a blog name.

Parameters

  • string $blogname: The (subdomain or directory) name

Source code

function get_blogaddress_by_name( $blogname ) {

	global $current_site;



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

}

1198

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: