Skip to content

Commit b4b522f

Browse files
committed
Fix links for submenus that have real parents when a submenu with admin.php as a parent is current. see WordPress#7948
git-svn-id: https://develop.svn.wordpress.org/trunk@9286 602fd350-edb4-49c9-b593-d223f7449a82
1 parent daaedd9 commit b4b522f

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

wp-admin/menu-header.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,10 @@ function _wp_menu_output( &$menu, &$submenu, $submenu_as_parent = true ) {
103103

104104
if ( file_exists(WP_PLUGIN_DIR . "/{$sub_item[2]}") || ! empty($menu_hook) ) {
105105
// If admin.php is the current page or if the parent exists as a file in the plugins or admin dir
106-
if ( 'admin.php' == $pagenow || ( (!file_exists(WP_PLUGIN_DIR . "/{$item[2]}") || is_dir(WP_PLUGIN_DIR . "/{$item[2]}") ) && !file_exists($item[2])) )
106+
$parent_exists = (file_exists(WP_PLUGIN_DIR . "/{$item[2]}") && !is_dir(WP_PLUGIN_DIR . "/{$item[2]}") ) || file_exists($item[2]);
107+
if ( $parent_exists )
108+
echo "<li$class><a href='{$item[2]}?page={$sub_item[2]}'$class>{$sub_item[0]}</a></li>";
109+
elseif ( 'admin.php' == $pagenow || !$parent_exists )
107110
echo "<li$class><a href='admin.php?page={$sub_item[2]}'$class>{$sub_item[0]}</a></li>";
108111
else
109112
echo "<li$class><a href='{$item[2]}?page={$sub_item[2]}'$class>{$sub_item[0]}</a></li>";

0 commit comments

Comments
 (0)