Title: allow_subdomain_install
Published: April 25, 2014
Last modified: May 20, 2026

---

# allow_subdomain_install(): bool

## In this article

 * [Return](https://developer.wordpress.org/reference/functions/allow_subdomain_install/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/allow_subdomain_install/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/allow_subdomain_install/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/allow_subdomain_install/?output_format=md#changelog)
 * [User Contributed Notes](https://developer.wordpress.org/reference/functions/allow_subdomain_install/?output_format=md#user-contributed-notes)

[ Back to top](https://developer.wordpress.org/reference/functions/allow_subdomain_install/?output_format=md#wp--skip-link--target)

Allow subdomain installation

## 󠀁[Return](https://developer.wordpress.org/reference/functions/allow_subdomain_install/?output_format=md#return)󠁿

 bool Whether subdomain installation is allowed

## 󠀁[Source](https://developer.wordpress.org/reference/functions/allow_subdomain_install/?output_format=md#source)󠁿

    ```php
    function allow_subdomain_install() {
    	$home   = get_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;
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/network.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-admin/includes/network.php#L35)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-admin/includes/network.php#L35-L43)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/allow_subdomain_install/?output_format=md#related)󠁿

| Uses | Description | 
| [get_option()](https://developer.wordpress.org/reference/functions/get_option/)`wp-includes/option.php` |

Retrieves an option value based on an option name.

  |

| Used by | Description | 
| [network_step1()](https://developer.wordpress.org/reference/functions/network_step1/)`wp-admin/includes/network.php` |

Prints step 1 for Network installation process.

  | 
| [network_step2()](https://developer.wordpress.org/reference/functions/network_step2/)`wp-admin/includes/network.php` |

Prints step 2 for Network installation process.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/allow_subdomain_install/?output_format=md#changelog)󠁿

| Version | Description | 
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |

## 󠀁[User Contributed Notes](https://developer.wordpress.org/reference/functions/allow_subdomain_install/?output_format=md#user-contributed-notes)󠁿

 1.   [Skip to note 2 content](https://developer.wordpress.org/reference/functions/allow_subdomain_install/?output_format=md#comment-content-6675)
 2.    [Muhibul Haque](https://profiles.wordpress.org/devmuhib/)  [  3 years ago  ](https://developer.wordpress.org/reference/functions/allow_subdomain_install/#comment-6675)
 3.  [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fallow_subdomain_install%2F%23comment-6675)
     Vote results for this note: 0[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fallow_subdomain_install%2F%23comment-6675)
 4.  The **[allow_subdomain_install()](https://developer.wordpress.org/reference/functions/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.
 5.  In a WordPress multisite network, you have the option to create either subdirectory-
     based or subdomain-based installations. Here’s what each option means:
 6.  **Subdirectory-Based Multisite:** In this mode, sites within the network 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/**.
 7.  **Subdomain-Based Multisite:** In this mode, sites within the network 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**.
 8.  The **[allow_subdomain_install()](https://developer.wordpress.org/reference/functions/allow_subdomain_install/)**
     function is used to check if subdomain-based multisite installations are allowed.
     The function returns **true** if subdomain-based installations are permitted, 
     and **false** if they are not.
 9.  Here’s a typical usage scenario:
 10.     ```php
         if (allow_subdomain_install()) {
             // Subdomain-based multisite is allowed.
             // You can proceed with subdomain-based multisite setup.
         } else {
             // Subdomain-based multisite is not allowed.
             // You may only set up subdirectory-based multisite.
         }
         ```
     
 11.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fallow_subdomain_install%2F%3Freplytocom%3D6675%23feedback-editor-6675)

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fallow_subdomain_install%2F)
before being able to contribute a note or feedback.