get_clean_basedomain

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

WordPress Version: 5.3

/**
 * Get base domain of network.
 *
 * @since 3.0.0
 * @return string Base domain.
 */
function get_clean_basedomain()
{
    $existing_domain = network_domain_check();
    if ($existing_domain) {
        return $existing_domain;
    }
    $domain = preg_replace('|https?://|', '', get_option('siteurl'));
    $slash = strpos($domain, '/');
    if ($slash) {
        $domain = substr($domain, 0, $slash);
    }
    return $domain;
}

WordPress Version: 3.7

/**
 * Get base domain of network.
 *
 * @since 3.0.0
 * @return string Base domain.
 */
function get_clean_basedomain()
{
    if ($existing_domain = network_domain_check()) {
        return $existing_domain;
    }
    $domain = preg_replace('|https?://|', '', get_option('siteurl'));
    if ($slash = strpos($domain, '/')) {
        $domain = substr($domain, 0, $slash);
    }
    return $domain;
}