Title: get_clean_basedomain
Published: April 25, 2014
Last modified: February 24, 2026

---

# get_clean_basedomain(): string

## In this article

 * [Return](https://developer.wordpress.org/reference/functions/get_clean_basedomain/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/get_clean_basedomain/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/get_clean_basedomain/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/get_clean_basedomain/?output_format=md#changelog)

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

Get base domain of network.

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

 string Base domain.

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

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

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

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

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

Check for an existing network.

  | 
| [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/get_clean_basedomain/?output_format=md#changelog)󠁿

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

## User Contributed Notes

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