• Здравствуйте.

    Необходимо убрать пункт «Меню» из кастомайзера. Написал следующий action (первые 8 строчек отработали на отлично, но вот с меню не выходит никак):

    
    add_action( 'customize_register', function ( WP_Customize_Manager $wp_customize ) {
    	$wp_customize->remove_section( 'static_front_page' );
    	$wp_customize->remove_section( 'background_image' );
    	$wp_customize->remove_section( 'header_image' );
    	$wp_customize->remove_section( 'installed_themes' );
    	$wp_customize->remove_section( 'wporg_themes' );
    	$wp_customize->remove_section( 'custom_css' );
    	$wp_customize->remove_section( 'colors' );
    	$wp_customize->remove_control( 'site_icon' );
    
    	$wp_customize->remove_section( 'nav_menus' ); // Не удаляет пункт из кастомайзера
    } );
    

    Подскажите, что делаю не так и как можно убрать данный пункт?

Просмотр 1 ответа (всего 1)
  • Разобрался, забыл добавить приоритет. В таком виде все отлично работает:

    
    add_action( 'customize_register', static function ( WP_Customize_Manager $wp_customize ) {
    	$wp_customize->remove_section( 'static_front_page' );
    	$wp_customize->remove_section( 'background_image' );
    	$wp_customize->remove_section( 'header_image' );
    	$wp_customize->remove_section( 'installed_themes' );
    	$wp_customize->remove_section( 'wporg_themes' );
    	$wp_customize->remove_section( 'custom_css' );
    	$wp_customize->remove_section( 'colors' );
    	$wp_customize->remove_control( 'site_icon' );
    	$wp_customize->remove_panel( 'nav_menus' );
    }, 999 );
    
Просмотр 1 ответа (всего 1)
  • Тема «Удалить пункт «Меню» из кастомайзера» закрыта для новых ответов.