Disable Theme Changing For WordPress

Posted On by Leach Creative

It often becomes necessary to remove functionality to prevent clients from accidentally messing up their website.  In this case we are going to remove the ability for them to change their WordPress theme with this snippet.  Just copy/paste this into functions.php.

The PHP

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

Source: Steve Taylor