From 538658c4de43c73ceaeb5f447b2162b522f1fbaa Mon Sep 17 00:00:00 2001 From: ryan Date: Wed, 1 Jun 2011 21:27:42 +0000 Subject: [PATCH] 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 git-svn-id: http://svn.automattic.com/wordpress/trunk@18109 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/menu.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/wp-admin/includes/menu.php b/wp-admin/includes/menu.php index a3ed33d8a..fa85e4b5d 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');