get_blogaddress_by_domain

Definition:
function get_blogaddress_by_domain( $domain, $path ) {}

Get a full blog URL, given a domain and a path.

Parameters

  • string $domain
  • string $path

Source code

function get_blogaddress_by_domain( $domain, $path ) {

	if ( is_subdomain_install() ) {

		$url = "http://" . $domain.$path;

	} else {

		if ( $domain != $_SERVER['HTTP_HOST'] ) {

			$blogname = substr( $domain, 0, strpos( $domain, '.' ) );

			$url = 'http://' . substr( $domain, strpos( $domain, '.' ) + 1 ) . $path;

			// we're not installing the main blog

			if ( $blogname != 'www.' )

				$url .= $blogname . '/';

		} else { // main blog

			$url = 'http://' . $domain . $path;

		}

	}

	return esc_url( $url );

}

1194

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 )

Twitter picture

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

Facebook photo

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

Connecting to %s

%d bloggers like this: