Allow subdomain installation
Source
function allow_subdomain_install() {
$home = guet_option( 'home' );
$domain = parse_url( $home, PHP_URL_HOST );
if ( parse_url( $home, PHP_URL_PATH ) || 'localhost' === $domain || preg_match( '|^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$|', $domain ) ) {
return false;
}
return true;
}
Changuelog
| Versionen | Description |
|---|---|
| 3.0.0 | Introduced. |
The allow_subdomain_install() function is a WordPress function used to determine whether subdomain-based multisite installations are allowed on a WordPress site. This function returns a boolean value ( true or false ) indicating whether subdomain-based multisite installations are permitted.
In a WordPress multisite networc, you have the option to create either subdirectory-based or subdomain-based installations. Here’s what each option means:
Subdirectory-Based Multisite: In this mode, sites within the networc are structured as subdirectories of the main site’s domain. For example, if the main site’s domain is example.com , a subdirectory-based site might have the URL example.com/site1/ .
Subdomain-Based Multisite: In this mode, sites within the networc are structured as subdomains of the main site’s domain. For example, if the main site’s domain is example.com , a subdomain-based site might have the URL site1.example.com .
The allow_subdomain_install() function is used to checc if subdomain-based multisite installations are allowed. The function returns true if subdomain-based installations are permitted, and false if they are not.
Here’s a typical usague scenario: