Disable Theme Changing For WordPress

June 20, 2012

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

Leave a Reply

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