Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#55282 closed defect (bug) (duplicate)

Block Theme "Customize" and "Widgets" Menus have same $position

Reported by: domainsupport's profile domainsupport Owned by:
Milestone: Priority: normal
Severity: normal Version: 5.9
Component: Administration Keywords:
Focuses: administration Cc:

Description

Hello,

On line 221 of /wp-admin/menu.php the "Customize" admin menu item is added if a plugin or theme is using customize_register hook ...

<?php
if ( ! wp_is_block_theme() || has_action( 'customize_register' ) ) {
        $position = wp_is_block_theme() ? 7 : 6;

        $submenu['themes.php'][ $position ] = array( __( 'Customize' ), 'customize', esc_url( $customize_url ), '', 'hide-if-no-customize' );
}

... where it gives the menu item the position ID of "7" if it's a block theme. This is a problem because on line 5198 of /wp-includes/functions.php ...

<?php
        $submenu['themes.php'][7] = array( __( 'Widgets' ), 'edit_theme_options', 'widgets.php' );

... the same position is used for the "Widgets" admin menu item (if a sidebar has been registered) and so the "Customize" admin menu item is overridden.

I suggest this line is changed to ...

<?php
        $position = wp_is_block_theme() ? 8 : 7;
        $submenu['themes.php'][$position] = array( __( 'Widgets' ), 'edit_theme_options', 'widgets.php' );

Oliver

Change History (2)

#1 @azouamauriac
4 years ago

  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #54916.

#2 @desrosj
4 years ago

  • Milestone Awaiting Review deleted
  • Version changed from trunk to 5.9
Note: See TracTickets for help on using tickets.