diff --git a/wp-admin/includes/menu.php b/wp-admin/includes/menu.php index a3ed33d8aa..fa85e4b5d8 100644 --- a/wp-admin/includes/menu.php +++ b/wp-admin/includes/menu.php @@ -215,11 +215,10 @@ if ( apply_filters('custom_menu_order', false) ) { } // Remove the last menu item if it is a separator. -$last_menu_item = end( $menu ); -if ( 'wp-menu-separator' == $last_menu_item[ 4 ] ) - array_pop( $menu ); -reset( $menu ); -unset( $last_menu_item ); +$last_menu_key = array_pop( array_keys( $menu ) ); +if ( 'wp-menu-separator' == $menu[ $last_menu_key ][ 4 ] ) + unset( $menu[ $last_menu_key ] ); +unset( $last_menu_key ); if ( !user_can_access_admin_page() ) { do_action('admin_page_access_denied');