mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-12 21:00:21 +00:00
Menus: Avoid a PHP warning in add_submenu_page() when the same value is passed for both $parent_slug and $menu_slug parameters.
Props welcher, ispreview, ayeshrajans, NextScripts, adamsilverstein, garrett-eclipse, 123host. Fixes #48599. git-svn-id: https://develop.svn.wordpress.org/trunk@46868 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user