get_clean_basedomain()WP 3.0.0

Get base domain of network.

No Hooks.

Return

String. Base domain.

Usage

get_clean_basedomain();

Changelog

Since 3.0.0 Introduced.

get_clean_basedomain() code WP 6.5.2

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