# Activate a Default Theme on New Network Sites

> Switches every newly created site to the theme you choose instead of the latest default theme.

- Type: PHP
- Runs: Run everywhere
- Category: [Multisite](https://wpide.com/library/category/multisite/)
- Tags: new-site, themes, defaults
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/ms-new-site-default-theme/

## Code

```php
if ( ! is_multisite() ) {
    return;
}

$wpide_theme = 'twentytwentyfour'; // Theme folder (stylesheet) name.

add_action( 'wp_initialize_site', function ( $site ) use ( $wpide_theme ) {
    $theme = wp_get_theme( $wpide_theme );

    if ( ! $theme->exists() ) {
        return;
    }

    switch_to_blog( $site->blog_id );
    switch_theme( $theme->get_stylesheet() );
    restore_current_blog();
}, 200 );
```

## Notes

Use the theme's folder name; the theme must be installed. Network-enable it too if site owners should be able to switch back to it.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Activate a Default Theme on New Network Sites" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
