get_blogaddress_by_id

函数


get_blogaddress_by_id ( $blog_id )
参数
  • (int)
    $blog_id
    Blog ID.
    Required:
返回值
  • (string) Full URL of the blog if found. Empty string if not.
定义位置
  • wp-includes/ms-blogs.php
    , line 41
引入
弃用

Get a full blog URL, given a blog ID.

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 );
}