WordPress.org

Make WordPress Core

Opened 2 years ago

Last modified 2 months ago

#38967 new defect (bug)

Customizer display Menus, although the theme not support menus

Reported by: elisa-demonki Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 3.9
Component: Customize Keywords: needs-patch has-screenshots
Focuses: Cc:

Description

The Customizer display the panel Menus, although the theme not support widgets or menus.

Attachments (1)

001513-Customize_.png (5.1 KB) - added by elisa-demonki 2 years ago.
customize-display-menus

Download all attachments as: .zip

Change History (8)

@elisa-demonki
2 years ago

customize-display-menus

#1 @swissspidy
2 years ago

Hey there,

Thanks for your report and welcome to WordPress Trac! Please note that menus can also be used in widgets. Theme do not need to add support for menus in order for you to use that functionality.

#2 @elisa-demonki
2 years ago

  • Severity changed from normal to minor

Thank you Swissspidy :)
Yes, the theme do not support widgets, too. (Menus are correct not display in admin menu.)

#3 @elisa-demonki
2 years ago

  • Severity changed from minor to normal

This ticket was mentioned in Slack in #core by helen. View the logs.


2 years ago

#5 @helen
2 years ago

  • Keywords reporter-feedback added

Hi @elisa-demonki - is this new to 4.7 or has it been this way for a while?

#6 @westonruter
2 years ago

  • Keywords needs-patch added; reporter-feedback removed
  • Milestone changed from Awaiting Review to Future Release
  • Version changed from trunk to 3.9

@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
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.

#7 @desrosj
2 months ago

  • Keywords has-screenshots added
Note: See TracTickets for help on using tickets.