我试图从WordPress customizer中删除菜单(见图)
我在函数上尝试了以下代码。php文件和除菜单外的所有部分都已删除
//Theme customizer
function mytheme_customize_register( $wp_customize ) {
//All our sections, settings, and controls will be added here
$wp_customize->remove_section( \'title_tagline\');
$wp_customize->remove_section( \'colors\');
$wp_customize->remove_section( \'header_image\');
$wp_customize->remove_section( \'background_image\');
$wp_customize->remove_section( \'menus\');
$wp_customize->remove_section( \'static_front_page\');
$wp_customize->remove_section( \'custom_css\');
}
add_action( \'customize_register\', \'mytheme_customize_register\' );
我甚至试过
$wp_customize->remove_panel( \'menus\');
但没有起作用,我在这里遗漏了一些东西。在此感谢您的帮助,提前感谢。
最合适的回答,由SO网友:AddWeb Solution Pvt Ltd 整理而成
尝试nav_menus 而不是menus 具有remove_panel()
function mytheme_customize_register( $wp_customize ) {
//All our sections, settings, and controls will be added here
$wp_customize->remove_section( \'title_tagline\');
$wp_customize->remove_section( \'colors\');
$wp_customize->remove_section( \'header_image\');
$wp_customize->remove_section( \'background_image\');
$wp_customize->remove_panel( \'nav_menus\');
$wp_customize->remove_section( \'static_front_page\');
$wp_customize->remove_section( \'custom_css\');
}
add_action( \'customize_register\', \'mytheme_customize_register\',50 );
希望这对你有帮助。
非常感谢。