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

WordPress Trac noreply at wordpress.org
Mon Aug 24 21:22:03 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:  2nd-opinion has-     |     Focuses:  javascript, administration
  patch                          |
---------------------------------+-----------------------------------------
Changes (by westonruter):

 * keywords:  needs-patch 2nd-opinion => 2nd-opinion has-patch


Comment:

 @DrewAPicture Great feedback. So yes, removing the panel shouldn't cause a
 JS error, so [attachment:33411.diff] makes sense. However, to truly remove
 the Nav Menus entirely, another extension mechanism is needed to hook in
 earlier to be able to override which Customizer features get loaded. This
 is useful for disabling features, but it is perhaps even more useful for
 plugins to introduce new features, and even for feature plugins to swap
 out Customizer components altogether. With that in mind, take a look at
 [attachment:33411.alt.diff].

 With that in place, you could disable menus in the Customizer just with
 this plugin:

 {{{#!php
 <?php
 add_action( 'customize_manager_construct', function( $wp_customize ) {
         $wp_customize->nav_menus = false;
 } );
 }}}

 Nice and clean.

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


More information about the wp-trac mailing list