get_blogaddress_by_id

Advertisement

Summery Summery

Get a full blog URL, given a blog id.

Syntax Syntax

get_blogaddress_by_id( int $blog_id )

Parameters Parameters

$blog_id

(int) (Required) Blog ID.

Return Return

(string) Full URL of the blog if found. Empty string if not.

Source Source

File: wp-includes/ms-blogs.php

function get_blogaddress_by_id( $blog_id ) {
	$bloginfo = get_site( (int) $blog_id );

	if ( empty( $bloginfo ) ) {
		return '';
	}

	$scheme = parse_url( $bloginfo->home, PHP_URL_SCHEME );
	$scheme = empty( $scheme ) ? 'http' : $scheme;

	return esc_url( $scheme . '://' . $bloginfo->domain . $bloginfo->path );
}

Advertisement

Changelog Changelog

Changelog
Version Description
MU (3.0.0) Introduced.

Advertisement

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.