diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php index 0e0f626e56..8923cc23f3 100644 --- a/src/wp-includes/functions.php +++ b/src/wp-includes/functions.php @@ -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 ); }