wpseek.com
Uma área de pesquisa sobre o WordPress para devs e autores do tema



get_blogaddress_by_id › WordPress Function

Desde
Obsoleton/a
get_blogaddress_by_id ( $blog_id )
Parâmetros:
  • (int) $blog_id Site ID.
    Required: Yes
Retorna:
  • (string) Full site URL if found. Empty string if not.
Definido em:
Codex:
Log de mudanças:
  • MU

Gets a full site URL, given a site ID.



Fonte

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 );
}