I want to start a new theme for my Multsite install instead of simply modifying the current theme. The problem is I have a lot of sites running on Multsite so it would be a little painful to change all my sites to the new theme one by one.

Is there a way to change the theme of sites by more then one at a time? In sites in network admin I can see a bulk actions option but when I select my sites and click apply, it does nothing (should it!?)

  • Any progress? Was my answer helpful? Do you still miss something?
    – fuxia
    Oct 6, 2012 at 22:29

2 Answers 2


I wouldn't recommend to use update_option for this task. Why? Because themes/plugins may use switch_theme action and it won't get run in such case. And this action is pretty important - it will allow you to save your widgets for example...

Another problem with Fuxias answer is that she uses template_directory hook. But there is no point to run it every time. If you set the theme, it is set, so you have to do it only once.

Here's the code that will loop through all subsites and set the theme to given one. Put it on your site, run once and then delete it (or comment it):

function switch_all_multisite_themes() {
    foreach ( get_sites() as $site ) {
        switch_to_blog( $site->blog_id );

        switch_theme( 'twentyeleven' );

switch_all_multisite_themes();  // run this function only once
  • Since the get_sites can just run to 100 by default: hookr.io/functions/get_sites; maybe is required a modification with big networks ( get_sites(array('fields' => 'ids', 'number' => NumberOfSitesOfTheNetwork))
    – Antonio D.
    Dec 21, 2019 at 12:13
  • For anyone wondering, you can add this snippet to your MU network homepage site's functions.php and refresh the frontend one time, then delete the snippet after confirming your other sites have successfully changed themes. Oct 24, 2022 at 12:06

Create a MU plugin and filter 'template_directory'.

Sample code to force TwentyEleven on all sites:

<?php # -*- coding: utf-8 -*-
// Plugin Name: Force Styleswitch
// 08.06.2012
add_filter( 'template_directory', 't5_switch_theme', 10, 3 );

function t5_switch_theme( $template_dir, $template, $theme_root )
    $forced_theme = 'twentyeleven';

    if ( $template !== $forced_theme )
        update_option( 'stylesheet', $forced_theme );

    return "$theme_root/$forced_theme";

You could also iterate over all blogs – use get_blog_count() and switch_to_blog() – and run the update just once.

The Network enable action in wp-admin/network/themes.php just makes a theme available on a site, it doesn’t set it as active theme.

  • Why don't you use switch_theme function and you're doing it the hard way with update_option? Feb 26, 2019 at 6:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.