0

I need to remove menu items from the menu section in the Wordpress theme customizer. Below are the screen shots: enter image description here

I have tried many things, but they didn't work. I just need to remove menu items from the menu.

function remove_unnessory_item_customizer($wp_customize) {
    $wp_customize->remove_section("themes");
   ///   $wp_customize->remove_section("available-menu-items");

     // $wp_customize->remove_section("content");  
   // $wp_customize->remove_panel("nav_menus");

   $wp_customize->remove_section( 'static_front_page' );
}

add_action('customize_register', 'remove_unnessory_item_customizer', 9999);
2
  • To clarify - are you asking how to remove the ability to adjust Menus from the Customizer? Or are you trying to remove only certain post types from being added to a Menu in the Customizer?
    – WebElaine
    May 25, 2017 at 15:54
  • Just I need to Remove the Page Items from the Menus of customizer May 26, 2017 at 4:23

1 Answer 1

1

Finally I was able to solve the above after researching on the net. Here I have removed the menu items by unregistering the content type.

function remove_post_types() {
    global $wp_post_types;
    if ( isset( $wp_post_types[ 'post' ] ) ) {
        unset( $wp_post_types[ 'post' ] );

          unset( $wp_post_types[ 'post' ] );
       return true;
    }
  return false;
}


add_action('init', 'remove_post_types');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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