I need to remove menu items from the menu section in the Wordpress theme customizer. Below are the screen shots:
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);
I need to remove menu items from the menu section in the Wordpress theme customizer. Below are the screen shots:
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);
Share
Improve this question
edited Jan 12, 2018 at 17:21
tklodd
1296 bronze badges
asked May 25, 2017 at 13:33
mohammed kaleemullamohammed kaleemulla
112 bronze badges
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 Commented May 25, 2017 at 15:54
- Just I need to Remove the Page Items from the Menus of customizer – mohammed kaleemulla Commented May 26, 2017 at 4:23
1 Answer
Reset to default 1Finally 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');