Administration: Do not specify menu order for the Widgets menu when the active theme is a block theme.

When using a block theme that declares Widgets support, it's better to not specify a menu order for the Widgets menu to avoid conflicts between menu items order.

Props Rufus87, ironprogrammer, audrasjb, hellofromTonya, davidbaumwald.
Fixes #54916.

Built from https://develop.svn.wordpress.org/trunk@53020


git-svn-id: http://core.svn.wordpress.org/trunk@52609 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
audrasjb 2022-03-29 15:59:22 +00:00
parent 8dc9fafcb6
commit 31c9e9452a
2 changed files with 9 additions and 2 deletions

View File

@ -5226,6 +5226,7 @@ function wp_maybe_load_widgets() {
* Append the Widgets menu to the themes main menu.
*
* @since 2.2.0
* @since 5.9.3 Don't specify menu order when the active theme is a block theme.
*
* @global array $submenu
*/
@ -5236,7 +5237,13 @@ function wp_widgets_add_menu() {
return;
}
$submenu['themes.php'][7] = array( __( 'Widgets' ), 'edit_theme_options', 'widgets.php' );
$menu_name = __( 'Widgets' );
if ( wp_is_block_theme() ) {
$submenu['themes.php'][] = array( $menu_name, 'edit_theme_options', 'widgets.php' );
} else {
$submenu['themes.php'][7] = array( $menu_name, 'edit_theme_options', 'widgets.php' );
}
ksort( $submenu['themes.php'], SORT_NUMERIC );
}

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.0-alpha-53018';
$wp_version = '6.0-alpha-53020';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.