diff --git a/wp-admin/includes/plugin.php b/wp-admin/includes/plugin.php index 6a33e04115..e1a6fa9d40 100644 --- a/wp-admin/includes/plugin.php +++ b/wp-admin/includes/plugin.php @@ -1390,8 +1390,9 @@ function add_submenu_page( $parent_slug, $page_title, $menu_title, $capability, $submenu[ $parent_slug ][] = $new_sub_menu; } else { - // If position is equal or higher than the number of items in the array, append the submenu. - if ( $position >= count( $submenu[ $parent_slug ] ) ) { + // Append the submenu if the parent item is not present in the submenu, + // or if position is equal or higher than the number of items in the array. + if ( ! isset( $submenu[ $parent_slug ] ) || $position >= count( $submenu[ $parent_slug ] ) ) { $submenu[ $parent_slug ][] = $new_sub_menu; } else { // Test for a negative position. diff --git a/wp-includes/version.php b/wp-includes/version.php index 7f39061f21..6ec3ae97e2 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.4-alpha-46866'; +$wp_version = '5.4-alpha-46868'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.