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
This commit is contained in:
ryan 2011-06-01 21:27:42 +00:00
parent 92343666f3
commit 538658c4de
1 changed files with 4 additions and 5 deletions

View File

@ -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');