The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

How to change the default theme to existing sites on Multisite? (12 posts)

  1. tomystein
    Posted 3 years ago #


    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! :)

  2. tomystein
    Posted 3 years ago #

    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...).


  3. tomystein
    Posted 3 years ago #

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

  4. WPyogi
    Forum Moderator
    Posted 3 years ago #

    Yes, there is a multisite forum - it's listed on this page:

    I will move this thread there for you :).

  5. tomystein
    Posted 3 years ago #

    Thanks a lot.

  6. 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 http://www.techonthenet.com/sql/update.php and practice on a safe local DB first! Also? BACKUP FIRST! :D

  7. tomystein
    Posted 3 years ago #

    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 :)


  8. tomystein
    Posted 3 years ago #

    Do I need to update current_theme as well?

    You mentioned template and stylesheet only.

  9. tomystein
    Posted 3 years ago #

    When I try this,

    UPDATE wp_3_options SET template = 'templatedir';

    It gives me an error:
    #1054 - Unknown column 'template' in 'field list'

  10. tomystein
    Posted 3 years ago #

    this worked for me.

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

  11. David Sader
    Posted 3 years ago #

    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' );
  12. Oh that is SLICK David! :D

Topic Closed

This topic has been closed to new replies.

About this Topic