WP prevent theme switching

In: PHP|WordPress

July 08th, 2010.

If you want to prevent client from switching WP theme by accident, use this WP snippet, brought to you by SoulSizzle design. Just put this code into your functions.php file, and users won’t have an option to switch theme in WP.

1
2
3
4
5
6
7
add_action('admin_init', 'remove_theme_menus');
function remove_theme_menus() {
	global $submenu;	
 
	unset($submenu['themes.php'][5]);
	unset($submenu['themes.php'][15]);
}

Written by

Dejan is pragmatic software developer with Master's Degree in Computer Science. He is currently based in Belgrade (Serbia).