WordPress.org

Make WordPress Core

Ticket #16946: menu.diff

File menu.diff, 981 bytes (added by mpvanwinkle77, 10 years ago)

Patch to wp-admin/menu.php

  • menu.php

     
    112112        // Check if it should be a submenu.
    113113        if ( $ptype_obj->show_in_menu !== true )
    114114                continue;
    115         $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.
     115       
     116        if( is_int($ptype_obj->menu_position) && $ptype_obj->menu_position == $_wp_last_object_menu) {
     117                $ptype_menu_position = $ptype_obj->menu_position;
     118                $_wp_last_object_menu++;
     119        } elseif(is_int($ptype_obj->menu_position) && isset($menu[$ptype_obj->menu_position])) {
     120                $ptype_menu_position = $ptype_obj->menu_position+1;     
     121        } else {
     122                $ptype_menu_position = $ptype_obj->menu_position;
     123        }
     124       
    116125        $ptype_for_id = sanitize_html_class( $ptype );
    117126        if ( is_string( $ptype_obj->menu_icon ) ) {
    118127                $menu_icon   = esc_url( $ptype_obj->menu_icon );