[wp-trac] [WordPress Trac] #55282: Block Theme "Customize" and "Widgets" Menus have same $position
WordPress Trac
noreply at wordpress.org
Tue Mar 1 10:36:50 UTC 2022
#55282: Block Theme "Customize" and "Widgets" Menus have same $position
----------------------------+-----------------------------
Reporter: domainsupport | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Administration | Version: trunk
Severity: normal | Keywords:
Focuses: administration |
----------------------------+-----------------------------
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
<?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
<?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
<?php
$position = wp_is_block_theme() ? 8 : 7;
$submenu['themes.php'][$position] = array( __( 'Widgets' ),
'edit_theme_options', 'widgets.php' );
}}}
Oliver
--
Ticket URL: <https://core.trac.wordpress.org/ticket/55282>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list