How to easily disable theme changing

May 3, 2011 at 2:38 pm

When creating a WordPress based website for a client, you may need to make sure that he can’t switch themes. This is what I’m going to show you in today’s recipe.

Simply paste the following piece of code in your functions.php file:

add_action('admin_init', 'slt_lock_theme');
function slt_lock_theme() {
	global $submenu, $userdata;
	get_currentuserinfo();
	if ($userdata->ID != 1) {
		unset($submenu['themes.php'][5]);
		unset($submenu['themes.php'][15]);
	}
}

Once saved, your client will not be able to switch themes anymore.

Thanks to Steve Taylor for this cool recipe!

Tags: