WordPress.org

Make WordPress Core


Ignore:
Timestamp:
12/09/2019 09:04:07 PM (23 months 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.
Merges [46868] to the 5.3 branch.
Fixes #48599.

Location:
branches/5.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/5.3

  • branches/5.3/src/wp-admin/includes/plugin.php

    r46570 r46869  
    13891389        $submenu[ $parent_slug ][] = $new_sub_menu;
    13901390    } else {
    1391         // If position is equal or higher than the number of items in the array, append the submenu.
    1392         if ( $position >= count( $submenu[ $parent_slug ] ) ) {
     1391        // Append the submenu if the parent item is not present in the submenu,
     1392        // or if position is equal or higher than the number of items in the array.
     1393        if ( ! isset( $submenu[ $parent_slug ] ) || $position >= count( $submenu[ $parent_slug ] ) ) {
    13931394            $submenu[ $parent_slug ][] = $new_sub_menu;
    13941395        } else {
Note: See TracChangeset for help on using the changeset viewer.