Disable WordPress theme changing
You’ve probably spent a lot of hours customizing the site’s theme, maybe even built it from the ground up to meet your client’s very specific needs. Either way, if you client swapped the theme it could spell disaster.
Luckily, there’s another handy code snippet you can use to remove the “Themes” menu item under “Appearances” in the admin sidebar. Just add this code to 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] ); } }
This code will hide the Themes sub-menu from all users other than user ID 1, who is usually the person who setup the site. This allows only the site’s creator to edit the site without having to keep editing the functions.php file.