0

I have followed the solution given here by Krupal Patel.

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" );

}

But I am unable to remove "Theme Options", "Menus" and "Header Media". Any help?

I am working on Twenty Seventeen.

2

The first thing to try is to increase the priority of your customize_register action from the default of 10 to something like 100. The reason for this is other components add their sections and controls in the same action and some after 10, so the things you are trying to remove may simply not have been added yet.

The second thing to note is that Widgets and Menus are a special case and they should not be disabled in this way. Instead, there is a dedicated filter you use to prevent them from getting loaded:

add_filter( 'customize_loaded_components', '__return_empty_array' );

For more see the hook docs.

See also my post on how to reset the Customizer to a blank slate.

| improve this answer | |
0

Well besides the answer given by Weston, i tried the following commands. All of them worked except for the menu one.

   $wp_customize->remove_panel("nav_menus");
   $wp_customize->remove_panel("widgets");

   $wp_customize->remove_section('header_image');  //removes Header Media
   $wp_customize->remove_section('title');

   $wp_customize->remove_section("static_front_page");
   $wp_customize->remove_section("custom_css");
   $wp_customize->remove_section("title_tagline");
   $wp_customize->remove_section("colors"); 
| improve this answer | |
  • Sorry, I tried, but for some reason the "Header Media" doesn't go away. – PauloP Jul 20 '17 at 18:55
  • you tried with remove_section() ? – Digvijayad Jul 20 '17 at 23:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.