Make WordPress Core

Changeset 18109


Ignore:
Timestamp:
06/01/2011 09:27:42 PM (13 years ago)
Author:
ryan
Message:

Use array_pop( array_keys() ) instead of end() to find the end of the array. end() finds that last item added, which is not reliable with plugins that add items to the end and then sort them up with custom_menu_order. see #17629

File:
1 edited

Legend:

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

    r18089 r18109  
    216216
    217217// Remove the last menu item if it is a separator.
    218 $last_menu_item = end( $menu );
    219 if ( 'wp-menu-separator' == $last_menu_item[ 4 ] )
    220     array_pop( $menu );
    221 reset( $menu );
    222 unset( $last_menu_item );
     218$last_menu_key = array_pop( array_keys( $menu ) );
     219if ( 'wp-menu-separator' == $menu[ $last_menu_key ][ 4 ] )
     220    unset( $menu[ $last_menu_key ] );
     221unset( $last_menu_key );
    223222
    224223if ( !user_can_access_admin_page() ) {
Note: See TracChangeset for help on using the changeset viewer.