Make WordPress Core


Ignore:
Timestamp:
05/25/2011 04:05:52 PM (15 years ago)
Author:
ryan
Message:

If there is only one submenu and it is has same destination as the parent, remove the submenu. fixes #17528

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/menu.php

    r16471 r18034  
    103103                $_wp_menu_nopriv[$data[2]] = true;
    104104
     105        // If there is only one submenu and it is has same destination as the parent,
     106        // remove the submenu.
     107        if ( 1 == count ( $submenu[$data[2]] ) ) {
     108                $subs = $submenu[$data[2]];
     109                $first_sub = array_shift($subs);
     110                if ( $data[2] == $first_sub[2] )
     111                        unset( $submenu[$data[2]] );
     112        }
     113
    105114        // If submenu is empty...
    106115        if ( empty($submenu[$data[2]]) ) {
     
    111120        }
    112121}
    113 unset($id, $data);
     122unset($id, $data, $subs, $first_sub);
    114123
    115124// Remove any duplicated seperators
Note: See TracChangeset for help on using the changeset viewer.