WordPress.org

Make WordPress Core

Ticket #16946: 16946.patch

File 16946.patch, 1018 bytes (added by johnjamesjacoby, 10 years ago)

Comment, whitespace, and patched from wp root

  • wp-admin/menu.php

     
    123123        // Check if it should be a submenu.
    124124        if ( $ptype_obj->show_in_menu !== true )
    125125                continue;
    126         $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.
     126
     127        // Adjust the position if it's already occupied
     128        if ( is_int( $ptype_obj->menu_position ) && ( $ptype_obj->menu_position == $_wp_last_object_menu ) ) {
     129                $ptype_menu_position = $ptype_obj->menu_position;
     130                $_wp_last_object_menu++;
     131        } elseif ( is_int( $ptype_obj->menu_position ) && isset( $menu[$ptype_obj->menu_position] ) ) {
     132                $ptype_menu_position = $ptype_obj->menu_position + 1;
     133        } else {
     134                $ptype_menu_position = $ptype_obj->menu_position;
     135        }
     136
    127137        $ptype_for_id = sanitize_html_class( $ptype );
    128138        if ( is_string( $ptype_obj->menu_icon ) ) {
    129139                $menu_icon   = esc_url( $ptype_obj->menu_icon );