On this page
get_blogaddress_by_id( int $blog_id ): string
Get a full blog URL, given a blog ID.
Parameters
$blog_idint Required-
Blog ID.
Return
string Full URL of the blog if found. Empty string if not.
Source
File: wp-includes/ms-blogs.php. View all references
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 );
}
Related
Uses
| Uses | Description |
|---|---|
| get_site() wp-includes/ms-site.php | Retrieves site data given a site ID or site object. |
| esc_url() wp-includes/formatting.php | Checks and cleans a URL. |
Used By
| Used By | Description |
|---|---|
| install_blog() wp-includes/ms-deprecated.php | Install an empty blog. |
| wpmu_welcome_notification() wp-includes/ms-functions.php | Notifies the site administrator that their site activation was successful. |
Changelog
| Version | Description |
|---|---|
| MU (3.0.0) | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/get_blogaddress_by_id