get_clean_basedomain() WordPress Function
The get_clean_basedomain() function strips the www. from a given domain name. This is useful for domain mapping, where the www. version of a domain may be mapped to a different server.
get_clean_basedomain() #
Get base domain of network.
Return
(string) Base domain.
Source
File: wp-admin/includes/network.php
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;
}
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
| Version | Description |
|---|---|
| 3.0.0 | Introduced. |