Wordpress - How do I remove a pre-existing customizer setting?
Late to the party but this will do the trick:
$wp_customize->remove_control('blogdescription');
You want to remove just that control, not entire section as suggested above.
Remove a pre exising customizer setting in wordpress theme with this code.
add_action( "customize_register", "ruth_sherman_theme_customize_register" );
function ruth_sherman_theme_customize_register( $wp_customize ) {
//=============================================================
// Remove header image and widgets option from theme customizer
//=============================================================
$wp_customize->remove_control("header_image");
$wp_customize->remove_panel("widgets");
//=============================================================
// Remove Colors, Background image, and Static front page
// option from theme customizer
//=============================================================
$wp_customize->remove_section("colors");
$wp_customize->remove_section("background_image");
$wp_customize->remove_section("static_front_page");
}
I found out the WP_Customize_Manager class has a function called remove_section()
. In your function hooked to customize_register
you can just do:
$wp_customize->remove_section('nav');
$wp_customize->remove_section('static_front_page');
You can find the ID of the section (i.e. 'nav') if you inspect the accordion title bar of the section. Look at the ID of the containing <li>
tag and it's the portion of the string after "customize-section-"
. I.E.:
<li id="customize-section-static_front_page" class="control-section customize-section">
-- the ID is "static_front_page"