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: https://develop.svn.wordpress.org/trunk@18109 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2011-06-01 21:27:42 +00:00
parent 599c9cc3a7
commit 218486fb46
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');