diff --git a/wp-admin/menu-header.php b/wp-admin/menu-header.php index 25ebaa00fa..c158cc2037 100644 --- a/wp-admin/menu-header.php +++ b/wp-admin/menu-header.php @@ -87,7 +87,7 @@ function _wp_menu_output( $menu, $submenu, $submenu_as_parent = true ) { $menu_file = $submenu_items[0][2]; if ( false !== ( $pos = strpos( $menu_file, '?' ) ) ) $menu_file = substr( $menu_file, 0, $pos ); - if ( ! empty( $menu_hook ) || ( ('index.php' != $submenu_items[0][2]) && file_exists( WP_PLUGIN_DIR . "/$menu_file" ) ) ) { + if ( ! empty( $menu_hook ) || ( ( 'index.php' != $submenu_items[0][2] ) && file_exists( WP_PLUGIN_DIR . "/$menu_file" ) && ! file_exists( ABSPATH . "/wp-admin/$menu_file" ) ) ) { $admin_is_parent = true; echo "$arrow"; } else { @@ -98,7 +98,7 @@ function _wp_menu_output( $menu, $submenu, $submenu_as_parent = true ) { $menu_file = $item[2]; if ( false !== ( $pos = strpos( $menu_file, '?' ) ) ) $menu_file = substr( $menu_file, 0, $pos ); - if ( ! empty( $menu_hook ) || ( ('index.php' != $item[2]) && file_exists( WP_PLUGIN_DIR . "/$menu_file" ) ) ) { + if ( ! empty( $menu_hook ) || ( ( 'index.php' != $item[2] ) && file_exists( WP_PLUGIN_DIR . "/$menu_file" ) && ! file_exists( ABSPATH . "/wp-admin/$menu_file" ) ) ) { $admin_is_parent = true; echo "\n\t$arrow"; } else { @@ -150,12 +150,12 @@ function _wp_menu_output( $menu, $submenu, $submenu_as_parent = true ) { $title = wptexturize($sub_item[0]); - if ( ! empty( $menu_hook ) || ( ('index.php' != $sub_item[2]) && file_exists( WP_PLUGIN_DIR . "/$sub_file" ) ) ) { + if ( ! empty( $menu_hook ) || ( ( 'index.php' != $sub_item[2] ) && file_exists( WP_PLUGIN_DIR . "/$sub_file" ) && ! file_exists( ABSPATH . "/wp-admin/$sub_file" ) ) ) { // If admin.php is the current page or if the parent exists as a file in the plugins or admin dir - if ( (!$admin_is_parent && file_exists(WP_PLUGIN_DIR . "/$menu_file") && !is_dir(WP_PLUGIN_DIR . "/{$item[2]}")) || file_exists($menu_file) ) - $sub_item_url = add_query_arg( array('page' => $sub_item[2]), $item[2] ); + if ( ( ! $admin_is_parent && file_exists( WP_PLUGIN_DIR . "/$menu_file" ) && ! is_dir( WP_PLUGIN_DIR . "/{$item[2]}" ) ) || file_exists( $menu_file ) ) + $sub_item_url = add_query_arg( array( 'page' => $sub_item[2] ), $item[2] ); else - $sub_item_url = add_query_arg( array('page' => $sub_item[2]), 'admin.php' ); + $sub_item_url = add_query_arg( array( 'page' => $sub_item[2] ), 'admin.php' ); $sub_item_url = esc_url( $sub_item_url ); echo "$title";