get_blogaddress_by_id()
Gets a full site URL, given a site ID.
Хуков нет.
Возвращает
string. Full site URL if found. Empty string if not.
Использование
get_blogaddress_by_id( $blog_id );
- $blog_id(int) (обязательный)
- Site ID.
Список изменений
| С версии 3.0.0 | Введена. |
Код get_blogaddress_by_id() get blogaddress by id WP 7.1.4
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 );
}