From aa616b1b457f4aa8f24c2c84702fee28f69ed27a Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Sat, 31 Oct 2015 20:30:06 +0000 Subject: [PATCH] Admin Menu: allow more than one menu item to be added at the same priority/position. Props chriscct7. Fixes #23316. git-svn-id: https://develop.svn.wordpress.org/trunk@35477 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/plugin.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/wp-admin/includes/plugin.php b/src/wp-admin/includes/plugin.php index 926e5e62c7..f0d207a567 100644 --- a/src/wp-admin/includes/plugin.php +++ b/src/wp-admin/includes/plugin.php @@ -1052,10 +1052,14 @@ function add_menu_page( $page_title, $menu_title, $capability, $menu_slug, $func $new_menu = array( $menu_title, $capability, $menu_slug, $page_title, 'menu-top ' . $icon_class . $hookname, $hookname, $icon_url ); - if ( null === $position ) + if ( null === $position ) { $menu[] = $new_menu; - else - $menu[$position] = $new_menu; + } elseif ( isset( $menu[ "$position" ] ) ) { + $position = $position + substr( base_convert( md5( $menu_slug . $menu_title ), 16, 10 ) , -5 ) * 0.00001; + $menu[ "$position" ] = $new_menu; + } else { + $menu[ $position ] = $new_menu; + } $_registered_pages[$hookname] = true;