Change Default Theme For WordPress Multisites
When you create a new site in WordPress multisite it will automatically assign a theme to the new site. It does not use the theme that you have activate on the other sites or on the network setup but will use the default theme that is setup in WordPress.
Depending on the version of WordPress you are using it will use a different default theme, at the time of writing this I am using WordPress 3.8 so my default theme for all new sites is twentyfourteen.
When you are setting up a new project where you want all the sites on the network to use the same theme then the admin user will have to switch to this theme everytime they create a new site.
The default theme is defined in the file default-constants.php, there is a constant variable defined called WP_DEFAULT_THEME.
if ( !defined('WP_DEFAULT_THEME') ) define( 'WP_DEFAULT_THEME', 'twentyfourteen' );
Because this variable is wrapped in a if not defined IF statement it means we can override the default theme in the wp-config.php file.
Open the wp-config.php file and add the following line anywhere before the line where WordPress includes the wp-settings file.
define( 'WP_DEFAULT_THEME', 'custom-theme' ); require_once(ABSPATH . 'wp-settings.php');
Learn how to code with Treehouse
- Learn projects with access to 1000+ videos
- Practice live with our Code Challenge Engine
- Get help in our members-only forums
Join the weekly newsletter
Sign up for our newsletter. You'll be updated on new tutorials as they come available.
Subscribe today and get a 50% discount code to Paulund