and if you’re using multisite, and want to keep your super admins ability to see that section, then:
function remove_customizer_settings( $wp_customize ){
if ( is_super_admin() ) {
} else {
$wp_customize->remove_panel('widgets'); // ok
$wp_customize->remove_panel('nav_menus');
$wp_customize->remove_section('themes');
}
}
add_action( 'customize_register', 'remove_customizer_settings', 20 );
Because this is the first hit on google, here’s more information, you need to set at least a priority of 20 to the code:
function remove_customizer_settings( $wp_customize ){
$wp_customize->remove_panel('widgets');
$wp_customize->remove_panel('nav_menus');
$wp_customize->remove_section('themes');
}
add_action( 'customize_register', 'remove_customizer_settings', 20 );