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.


Top ↑

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


Top ↑

Changelog

Changelog
VersionDescription
3.0.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.