函数原型
get_blogaddress_by_id( int $blog_id ): string
函数描述
Get a full blog URL, given a blog ID.
是否弃用
未弃用
函数参数
-
$blog_id
int
Required - Blog ID.
函数返回值
string Full URL of the blog if found. Empty string if not.
函数位置
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 );
}
源码链接
变更日志
| Version | Description |
|---|---|
| MU (3.0.0) | Introduced. |

