DISCLAIMER: this post is older than one year and may not be up to date with latest WordPress version.

Did you know that in WordPress, the $theme variable control the apparence of your blog? In fact, its value is the name of your theme. In this recipe, I’m going to show you how you can switch themes using a simple code snippet.

Just paste the following code in the functions.php file. When this code will be executed, the “default” theme will replace your current theme.

add_filter('option_template', 'dontchoose');
add_filter('template', 'dontchoose');
add_filter('option_template', 'dontchoose');
add_filter('option_stylesheet', 'dontchoose');

function dontchoose($theme) {
	$theme = 'default';
	return $theme;

This recipe was inspired by Nathan Rice’s code to Serve IE6 Visitors the Default WordPress Theme, make sure to check it out too!


Leave a Comment

Your email address will not be published. Required fields are marked *