Ticket #16946: 16946.diff
| File 16946.diff, 2.1 KB (added by blepoxp, 2 years ago) |
|---|
-
wp-admin/includes/plugin.php
888 888 if ( null === $position ) 889 889 $menu[] = $new_menu; 890 890 else 891 $ menu[$position] = $new_menu;891 $position = $menu[get_unique_menu_key( $position )] = $new_menu; 892 892 893 893 $_registered_pages[$hookname] = true; 894 894 … … 1483 1483 return $title; 1484 1484 } 1485 1485 1486 /** 1487 * Preserves core menu keys as well as keys previously set by various APIs 1488 * 1489 * If requested key has already been set or will be set by core, bump it util we find a free one 1490 * 1491 * @param int $int The position in the menu order this one should appear 1492 * @return int 1493 */ 1494 function get_unique_menu_key( $int ) { 1495 global $menu; 1496 1497 $core_menu_positions = array( 2, 4, 5, 10, 15, 20, 25, 59, 60, 65, 70, 75, 80, 99); 1498 while ( isset($menu[$int] ) || in_array( $int, $core_menu_positions ) ) 1499 $int++; 1500 1501 return $int; 1502 } 1503 1486 1504 function get_plugin_page_hook( $plugin_page, $parent_page ) { 1487 1505 $hook = get_plugin_page_hookname( $plugin_page, $parent_page ); 1488 1506 if ( has_action($hook) ) -
wp-admin/menu.php
122 122 $ptype_class = 'post'; 123 123 } 124 124 125 // if $ptype_menu_position is already populated or will be populated by a hard-coded value below, increment the position. 126 $core_menu_positions = array(59, 60, 65, 70, 75, 80, 85, 99); 127 while ( isset($menu[$ptype_menu_position]) || in_array($ptype_menu_position, $core_menu_positions) ) 128 $ptype_menu_position++; 125 $ptype_menu_position = get_unique_menu_key( $ptype_menu_position ); 129 126 130 127 $menu[$ptype_menu_position] = array( esc_attr( $ptype_obj->labels->menu_name ), $ptype_obj->cap->edit_posts, "edit.php?post_type=$ptype", '', 'menu-top menu-icon-' . $ptype_class, 'menu-posts-' . $ptype_for_id, $menu_icon ); 131 128 $submenu["edit.php?post_type=$ptype"][5] = array( $ptype_obj->labels->menu_name, $ptype_obj->cap->edit_posts, "edit.php?post_type=$ptype");
