[wp-trac] [WordPress Trac] #38967: Customizer display Menus, although the theme not support menus

WordPress Trac noreply at wordpress.org
Thu Dec 1 00:20:19 UTC 2016


#38967: Customizer display Menus, although the theme not support menus
---------------------------+-----------------------------
 Reporter:  elisa-demonki  |       Owner:
     Type:  defect (bug)   |      Status:  new
 Priority:  normal         |   Milestone:  Future Release
Component:  Customize      |     Version:  3.9
 Severity:  normal         |  Resolution:
 Keywords:  needs-patch    |     Focuses:
---------------------------+-----------------------------
Changes (by westonruter):

 * keywords:  reporter-feedback => needs-patch
 * version:  trunk => 3.9
 * milestone:  Awaiting Review => Future Release


Comment:

 @elisa-demonki I just checked in 4.6 and the issue is there as well. The
 `WP_Customize_Widgets` and `WP_Customize_Nav_Menus` classes need to be
 checking for `widgets` and `nav-menus` theme support respectively before
 they start adding their extensions. Note that the constructors for each
 will need to be carefully refactored to move hooks to a later point when
 `after_setup_theme` is called. Either this, or at the very least the
 `active_callback` can at the very last moment return `false` for these two
 panels if the theme support is not present. But it would seem preferable
 to short-circuit the components entirely when possible.

 @elisa-demonki For the time being, you can add a ''plugin'' (not in your
 ''theme'', which is loaded too late) which short-circuits these components
 from being loaded by doing:

 {{{#!php
 <?php
 add_filter( 'customize_loaded_components', function( $components ) {
     return array_filter( $components, function( $component ) {
         return 'widgets' !== $component && 'nav_menus' !== $component;
     } );
 } );
 }}}

 This filter was introduced in #33552.

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


More information about the wp-trac mailing list