wpseek.com
WordPress开发者和主题制作者的搜索引擎



get_blogaddress_by_id › WordPress Function

Since
已弃用n/a
get_blogaddress_by_id ( $blog_id )
参数:
  • (int) $blog_id Site ID.
    Required: Yes
返回:
  • (string) Full site URL if found. Empty string if not.
定义在:
文档:
Change Log:
  • MU

Gets a full site URL, given a site 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 );
}