WordPress Customizer is a fundamental tool for the design of your website, and the themes you install add lots of settings and sections to make it easier, but haven’t you noticed that there are sections that you have left over, that you would remove?
Well, it turns out that it is very easy to hide or remove sections of the WordPress customizer, you just have to use an action that calls the $wp_customize
object to hide sections and settings, just like you would do to add them.
In the following code you have a function that will hide all the default WordPress sections of the customizer:
/* Hide sections from WordPress customizer */
function hide_customizer_sections( $wp_customize ) {
$wp_customize->remove_section( 'title_tagline' ); // Site identity
$wp_customize->remove_section( 'static_front_page' ); // Homepage settings
$wp_customize->remove_section( 'colors' ); // Colors
$wp_customize->remove_panel( 'nav_menus'); // Menus
$wp_customize->remove_panel( 'widgets' ); // Widgets
$wp_customize->remove_section( 'header_image' ); // Header imagen
$wp_customize->remove_section( 'background_image' ); // Background image
$wp_customize->remove_section( 'themes' ); // Themes
$wp_customize->remove_control( 'custom_css' ); // Custom CSS
}
add_action( 'customize_register', 'hide_customizer_sections', 30);
Code language: PHP (php)
If you add this code to the end of the functions.php file of the active theme or in your utility plugin, you would go from this…

To this.

As you can see, all standard WordPress sections of the customizer have been removed, leaving only those that belong to the active theme.
Once you see the result, if you do not want to remove any section of the customizer, just edit the code above and “comment” the lines of the sections you do not want to remove from the customizer.
When commenting (we add //
at the beginning of the line) the lines of the menu and widget sections, something very commonly used, we make those parts not readable as code.
You would now have the customizer settings sections specific to the active theme, in addition to the WordPress menu and widget sections, for when you want to customize menus and widgets at any time.
In any case, I hope you liked the trick, and that you’ll take advantage of it for your own website or customer websites where you don’t want them to touch “the wrong thing”.
Read this post in Spanish: Cómo quitar secciones del personalizador de WordPress