WordPress.org

Make WordPress Core

Ticket #16946: 16946.2.patch

File 16946.2.patch, 1008 bytes (added by Mte90, 5 years ago)

patch refreshed

  • wp-admin/menu.php

     
    9494        // Check if it should be a submenu.
    9595        if ( $ptype_obj->show_in_menu !== true )
    9696                continue;
    97         $ptype_menu_position = is_int( $ptype_obj->menu_position ) ? $ptype_obj->menu_position : ++$_wp_last_object_menu; // If we're to use $_wp_last_object_menu, increment it first.
     97        // Adjust the position if it's already occupied
     98        if ( is_int( $ptype_obj->menu_position ) && ( $ptype_obj->menu_position == $_wp_last_object_menu ) ) {
     99                $ptype_menu_position = $ptype_obj->menu_position;
     100                $_wp_last_object_menu;
     101        } elseif ( is_int( $ptype_obj->menu_position ) && isset( $menu[$ptype_obj->menu_position] ) ) {
     102                $ptype_menu_position = $ptype_obj->menu_position + 1;
     103        } else {
     104                $ptype_menu_position = $ptype_obj->menu_position;
     105        }
    98106        $ptype_for_id = sanitize_html_class( $ptype );
    99107
    100108        $menu_icon = 'dashicons-admin-post';