allow_subdomain_install() WordPress Function

The allow_subdomain_install() function enables the installation of a Wordpress site on a subdomain. This is useful if you want to create a Wordpress site for a specific subdomain, such as blog.example.com.

allow_subdomain_install() #

Allow subdomain installation


Return

(bool) Whether subdomain installation is allowed


Top ↑

Source

File: wp-admin/includes/network.php

function allow_subdomain_install() {
	$domain = preg_replace( '|https?://([^/]+)|', '$1', get_option( 'home' ) );
	if ( parse_url( get_option( 'home' ), PHP_URL_PATH ) || 'localhost' === $domain || preg_match( '|^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$|', $domain ) ) {
		return false;
	}

	return true;
}


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.