[wp-trac] [WordPress Trac] #33411: remove_panel('nav_menus') action generates errors

WordPress Trac noreply at wordpress.org
Mon Aug 24 05:11:36 UTC 2015


#33411: remove_panel('nav_menus') action generates errors
--------------------------+-----------------------------
 Reporter:  IstanbulMMV   |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  4.3.1
Component:  Customize     |     Version:  4.3
 Severity:  normal        |  Resolution:
 Keywords:  needs-patch   |     Focuses:  administration
--------------------------+-----------------------------
Changes (by westonruter):

 * milestone:  Awaiting Review => 4.3.1


Comment:

 Replying to [comment:4 AJClarke]:
 > @IstanbulMMV  - Setting the a active_callback will simply hide the
 panel. It won't actually have any improvements in the Customizer loading
 time. Just so you know ;)

 If you really need to disable menus in the Customizer entirely, then you
 can just undo the actions/filters that are added by
 `WP_Customize_Nav_Menus::__construct()`, for instance with this plugin:

 {{{#!php
 <?php
 add_action( 'customize_register', function( $wp_customize ) {
         /** @var WP_Customize_Manager $wp_customize */
         remove_action( 'customize_controls_enqueue_scripts', array(
 $wp_customize->nav_menus, 'enqueue_scripts' ) );
         remove_action( 'customize_register', array(
 $wp_customize->nav_menus, 'customize_register' ), 11 );
         remove_filter( 'customize_dynamic_setting_args', array(
 $wp_customize->nav_menus, 'filter_dynamic_setting_args' ) );
         remove_filter( 'customize_dynamic_setting_class', array(
 $wp_customize->nav_menus, 'filter_dynamic_setting_class' ) );
         remove_action( 'customize_controls_print_footer_scripts', array(
 $wp_customize->nav_menus, 'print_templates' ) );
         remove_action( 'customize_controls_print_footer_scripts', array(
 $wp_customize->nav_menus, 'available_items_template' ) );
         remove_action( 'customize_preview_init', array(
 $wp_customize->nav_menus, 'customize_preview_init' ) );
 }, 10 );
 }}}

 But yes, otherwise there should be no JS error if the `nav_menus` panel is
 removed.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/33411#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list