Support » Networking WordPress » How to change the default theme to existing sites on Multisite?

  • Hi,

    I’ve read a lot about this issue and tried many things but can’t get the result I want – to change the default twentyeleven theme.

    I’ve put this line in wp-config, with the theme folder I want:
    define(‘WP_DEFAULT_THEME’, ‘classic’);
    I get a blank page.

    Tried also to change the names of the themes in their stylesheets, their folder names. To change the default theme in default-constants.php. Nothing works.

    I am working with subdomains if that’s important to mention.
    I have a network of 50 sites and want to change all themes at once.

    Advice will be appreciated! 🙂

Viewing 11 replies - 1 through 11 (of 11 total)
  • I thought maybe using a kind of this command:

    SELECT * FROM wp_options WHERE option_name = 'template' OR option_name = 'stylesheet' OR option_name = 'current_theme';

    But I don’t know how to select all wp_options (wp_2_options, etc…).


    Does anybody have any experince with this? Is it the proper place to ask or is there a multisite forum for questions like this?



    Forum Moderator

    Yes, there is a multisite forum – it’s listed on this page:

    I will move this thread there for you :).

    Thanks a lot.

    Moderator Ipstenu (Mika Epstein)


    🏳️‍🌈 Halfelf Rogue & Plugin Review Team Rep

    For existing sites you have to edit them manually or via the DB.

    And you can’t select multiple tables on a search easily in SQL (for a variety of ‘don’t shoot yourself in the foot’ reasons). You’d have to script something via PHP or shell.

    Honestly, I’d do something like this:

    UPDATE wp_options SET template = 'current_theme', stylesheet = 'current_theme';
    UPDATE wp_2_options SET template = 'current_theme', stylesheet = 'current_theme';

    And make all fifty. Then paste it into phpMyAdmin and it’ll run ’em all.

    Read and practice on a safe local DB first! Also? BACKUP FIRST! 😀

    I think I will use Excel to create all the wp_options and then use the command you recommended, which I was thinking about as well 🙂


    Do I need to update current_theme as well?

    You mentioned template and stylesheet only.

    When I try this,

    UPDATE wp_3_options SET template = 'templatedir';

    It gives me an error:
    #1054 – Unknown column ‘template’ in ‘field list’

    this worked for me.

    UPDATE wp_options SET option_value='test' WHERE option_name='template' OR option_name='stylesheet';

    I’ll offer a couple snippets from my “mu-plugins”.

    First, as a temporary network-wide override of each site’s theme WITHOUT altering the site-by-site theme options.

    add_filter( 'pre_option_' . 'template', 'override_template' );
    add_filter( 'pre_option_' . 'stylesheet', 'override_stylesheet' );
    function my_override_template() {
    	$foo = 'twentytwelve';
    	return $foo;
    function my_override_stylesheet() {
    	$bar = 'twentytwelve';
    	return $bar;

    Second, to actually change each site’s theme options I’d hook the Update Network button with this snippet in “mu-plugins”:

    function my_theme( $blog_id ) {
    update_blog_option( $blog_id, 'template', 'twentytwelve' );
    update_blog_option( $blog_id, 'stylesheet', 'twentytwelve' );
    add_action( 'wpmu_upgrade_site', 'my_theme' );
    Moderator Ipstenu (Mika Epstein)


    🏳️‍🌈 Halfelf Rogue & Plugin Review Team Rep

    Oh that is SLICK David! 😀

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘How to change the default theme to existing sites on Multisite?’ is closed to new replies.