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

---

# make_site_theme(): string|false

## In this article

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

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

Creates a site theme.

## 󠀁[Description](https://developer.wordpress.org/reference/functions/make_site_theme/?output_format=md#description)󠁿

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

 string|false

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

    ```php
    function make_site_theme() {
    	// Name the theme after the blog.
    	$theme_name = __get_option( 'blogname' );
    	$template   = sanitize_title( $theme_name );
    	$site_dir   = WP_CONTENT_DIR . "/themes/$template";

    	// If the theme already exists, nothing to do.
    	if ( is_dir( $site_dir ) ) {
    		return false;
    	}

    	// We must be able to write to the themes dir.
    	if ( ! is_writable( WP_CONTENT_DIR . '/themes' ) ) {
    		return false;
    	}

    	umask( 0 );
    	if ( ! mkdir( $site_dir, 0777 ) ) {
    		return false;
    	}

    	if ( file_exists( ABSPATH . 'wp-layout.css' ) ) {
    		if ( ! make_site_theme_from_oldschool( $theme_name, $template ) ) {
    			// TODO: rm -rf the site theme directory.
    			return false;
    		}
    	} else {
    		if ( ! make_site_theme_from_default( $theme_name, $template ) ) {
    			// TODO: rm -rf the site theme directory.
    			return false;
    		}
    	}

    	// Make the new site theme active.
    	$current_template = __get_option( 'template' );
    	if ( WP_DEFAULT_THEME === $current_template ) {
    		update_option( 'template', $template );
    		update_option( 'stylesheet', $template );
    	}
    	return $template;
    }
    ```

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

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

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

Creates a site theme from an existing theme.

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

Creates a site theme from the default theme.

  | 
| [sanitize_title()](https://developer.wordpress.org/reference/functions/sanitize_title/)`wp-includes/formatting.php` |

Sanitizes a string into a slug, which can be used in URLs or HTML attributes.

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

Updates the value of an option that was already added.

  |

[Show 1 more](https://developer.wordpress.org/reference/functions/make_site_theme/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/functions/make_site_theme/?output_format=md#)

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

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

## User Contributed Notes

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