get_blogaddress_by_id()
Gets a full site URL, given a site ID.
No Hooks.
Return
String
. Full site URL if found. Empty string if not.
Usage
get_blogaddress_by_id( $blog_id );
- $blog_id(int) (required)
- Site ID.
Changelog
Since 3.0.0 | Introduced. |
get_blogaddress_by_id() get blogaddress by id code WP 6.7.1
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 ); }