Make WordPress Core


Ignore:
Timestamp:
12/09/2019 09:01:13 PM (5 years ago)
Author:
SergeyBiryukov
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/plugin.php

    r46696 r46868  
    13911391        $submenu[ $parent_slug ][] = $new_sub_menu;
    13921392    } else {
    1393         // If position is equal or higher than the number of items in the array, append the submenu.
    1394         if ( $position >= count( $submenu[ $parent_slug ] ) ) {
     1393        // Append the submenu if the parent item is not present in the submenu,
     1394        // or if position is equal or higher than the number of items in the array.
     1395        if ( ! isset( $submenu[ $parent_slug ] ) || $position >= count( $submenu[ $parent_slug ] ) ) {
    13951396            $submenu[ $parent_slug ][] = $new_sub_menu;
    13961397        } else {
Note: See TracChangeset for help on using the changeset viewer.