diff --git a/wp-admin/menu-header.php b/wp-admin/menu-header.php
index d8b7e6af3e..e6210610eb 100644
--- a/wp-admin/menu-header.php
+++ b/wp-admin/menu-header.php
@@ -59,6 +59,31 @@ foreach ( $menu as $key => $item ) {
echo "\n\t
{$item[0]}";
}
}
+
+foreach ( $menu as $key => $item ) {
+ if ( $key < 41 ) // there is a more efficient way to do this!
+ continue;
+
+ $class = '';
+
+ // 0 = name, 1 = capability, 2 = file
+ if (( strcmp($self, $item[2]) == 0 && empty($parent_file)) || ($parent_file && ($item[2] == $parent_file))) $class = ' class="current"';
+
+ if ( !empty($submenu[$item[2]]) ) {
+ $submenu[$item[2]] = array_values($submenu[$item[2]]); // Re-index.
+ $menu_hook = get_plugin_page_hook($submenu[$item[2]][0][2], $item[2]);
+ if ( file_exists(ABSPATH . PLUGINDIR . "/{$submenu[$item[2]][0][2]}") || !empty($menu_hook))
+ echo "\n\t{$item[0]}";
+ else
+ echo "\n\t{$item[0]}";
+ } else if ( current_user_can($item[1]) ) {
+ if ( file_exists(ABSPATH . PLUGINDIR . "/{$item[2]}") )
+ echo "\n\t{$item[0]}";
+ else
+ echo "\n\t{$item[0]}";
+ }
+}
+
do_action( 'adminmenu' );
?>
@@ -66,7 +91,7 @@ do_action( 'adminmenu' );