get_blogaddress_by_domain

The timeline below displays how wordpress function get_blogaddress_by_domain has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.3

/**
 * Get a full site URL, given a domain and a path.
 *
 * @since MU (3.0.0)
 * @deprecated 3.7.0
 *
 * @param string $domain
 * @param string $path
 * @return string
 */
function get_blogaddress_by_domain($domain, $path)
{
    _deprecated_function(__FUNCTION__, '3.7.0');
    if (is_subdomain_install()) {
        $url = "http://" . $domain . $path;
    } else if ($domain != $_SERVER['HTTP_HOST']) {
        $blogname = substr($domain, 0, strpos($domain, '.'));
        $url = 'http://' . substr($domain, strpos($domain, '.') + 1) . $path;
        // We're not installing the main blog.
        if ('www.' !== $blogname) {
            $url .= $blogname . '/';
        }
    } else {
        // Main blog.
        $url = 'http://' . $domain . $path;
    }
    return sanitize_url($url);
}

WordPress Version: 6.1

/**
 * Get a full blog URL, given a domain and a path.
 *
 * @since MU (3.0.0)
 * @deprecated 3.7.0
 *
 * @param string $domain
 * @param string $path
 * @return string
 */
function get_blogaddress_by_domain($domain, $path)
{
    _deprecated_function(__FUNCTION__, '3.7.0');
    if (is_subdomain_install()) {
        $url = "http://" . $domain . $path;
    } else if ($domain != $_SERVER['HTTP_HOST']) {
        $blogname = substr($domain, 0, strpos($domain, '.'));
        $url = 'http://' . substr($domain, strpos($domain, '.') + 1) . $path;
        // We're not installing the main blog.
        if ('www.' !== $blogname) {
            $url .= $blogname . '/';
        }
    } else {
        // Main blog.
        $url = 'http://' . $domain . $path;
    }
    return sanitize_url($url);
}

WordPress Version: 5.5

/**
 * Get a full blog URL, given a domain and a path.
 *
 * @since MU (3.0.0)
 * @deprecated 3.7.0
 *
 * @param string $domain
 * @param string $path
 * @return string
 */
function get_blogaddress_by_domain($domain, $path)
{
    _deprecated_function(__FUNCTION__, '3.7.0');
    if (is_subdomain_install()) {
        $url = "http://" . $domain . $path;
    } else if ($domain != $_SERVER['HTTP_HOST']) {
        $blogname = substr($domain, 0, strpos($domain, '.'));
        $url = 'http://' . substr($domain, strpos($domain, '.') + 1) . $path;
        // We're not installing the main blog.
        if ('www.' !== $blogname) {
            $url .= $blogname . '/';
        }
    } else {
        // Main blog.
        $url = 'http://' . $domain . $path;
    }
    return esc_url_raw($url);
}

WordPress Version: 5.4

/**
 * Get a full blog URL, given a domain and a path.
 *
 * @since MU (3.0.0)
 * @deprecated 3.7.0
 *
 * @param string $domain
 * @param string $path
 * @return string
 */
function get_blogaddress_by_domain($domain, $path)
{
    _deprecated_function(__FUNCTION__, '3.7.0');
    if (is_subdomain_install()) {
        $url = "http://" . $domain . $path;
    } else if ($domain != $_SERVER['HTTP_HOST']) {
        $blogname = substr($domain, 0, strpos($domain, '.'));
        $url = 'http://' . substr($domain, strpos($domain, '.') + 1) . $path;
        // We're not installing the main blog.
        if ($blogname != 'www.') {
            $url .= $blogname . '/';
        }
    } else {
        // Main blog.
        $url = 'http://' . $domain . $path;
    }
    return esc_url_raw($url);
}

WordPress Version: 4.9

/**
 * Get a full blog URL, given a domain and a path.
 *
 * @since MU (3.0.0)
 * @deprecated 3.7.0
 *
 * @param string $domain
 * @param string $path
 * @return string
 */
function get_blogaddress_by_domain($domain, $path)
{
    _deprecated_function(__FUNCTION__, '3.7.0');
    if (is_subdomain_install()) {
        $url = "http://" . $domain . $path;
    } else if ($domain != $_SERVER['HTTP_HOST']) {
        $blogname = substr($domain, 0, strpos($domain, '.'));
        $url = 'http://' . substr($domain, strpos($domain, '.') + 1) . $path;
        // we're not installing the main blog
        if ($blogname != 'www.') {
            $url .= $blogname . '/';
        }
    } else {
        // main blog
        $url = 'http://' . $domain . $path;
    }
    return esc_url_raw($url);
}

WordPress Version: 4.6

/**
 * Get a full blog URL, given a domain and a path.
 *
 * @since MU
 * @deprecated 3.7.0
 *
 * @param string $domain
 * @param string $path
 * @return string
 */
function get_blogaddress_by_domain($domain, $path)
{
    _deprecated_function(__FUNCTION__, '3.7.0');
    if (is_subdomain_install()) {
        $url = "http://" . $domain . $path;
    } else if ($domain != $_SERVER['HTTP_HOST']) {
        $blogname = substr($domain, 0, strpos($domain, '.'));
        $url = 'http://' . substr($domain, strpos($domain, '.') + 1) . $path;
        // we're not installing the main blog
        if ($blogname != 'www.') {
            $url .= $blogname . '/';
        }
    } else {
        // main blog
        $url = 'http://' . $domain . $path;
    }
    return esc_url_raw($url);
}

WordPress Version: 3.7

/**
 * Get a full blog URL, given a domain and a path.
 *
 * @since MU
 * @deprecated 3.7.0
 *
 * @param string $domain
 * @param string $path
 * @return string
 */
function get_blogaddress_by_domain($domain, $path)
{
    _deprecated_function(__FUNCTION__, '3.7');
    if (is_subdomain_install()) {
        $url = "http://" . $domain . $path;
    } else if ($domain != $_SERVER['HTTP_HOST']) {
        $blogname = substr($domain, 0, strpos($domain, '.'));
        $url = 'http://' . substr($domain, strpos($domain, '.') + 1) . $path;
        // we're not installing the main blog
        if ($blogname != 'www.') {
            $url .= $blogname . '/';
        }
    } else {
        // main blog
        $url = 'http://' . $domain . $path;
    }
    return esc_url_raw($url);
}