Created
December 3, 2014 17:59
-
-
Save bappi-d-great/da2052c90ebcb28805da to your computer and use it in GitHub Desktop.
Enable a theme in all subsites
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// RUN IT ONCE ONLY and USE as mu-plugin | |
/* | |
* To use mu-plugins, go to /wp-content/ and find the folder with name 'mu-plugins'. | |
* If there is no folder in that name, then create a folder, name it 'mu-plugins', | |
* create a file inside that, give any name you like and paste the code in there. | |
* You don't need to activate that plugin. Mu-plugins means must use plugins, so it will be activated automatically always. | |
* If you use mu-plugins then add a php start tag at the beginning of the code. | |
*/ | |
$sites = wp_get_sites(); | |
foreach( $sites as $site ) { | |
switch_to_blog( $site['blog_id'] ); | |
// Change to your theme | |
switch_theme( 'twentytwelve', 'twentytwelve' ); | |
restore_current_blog(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment