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:
parent
599c9cc3a7
commit
218486fb46
@ -215,11 +215,10 @@ if ( apply_filters('custom_menu_order', false) ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Remove the last menu item if it is a separator.
|
// Remove the last menu item if it is a separator.
|
||||||
$last_menu_item = end( $menu );
|
$last_menu_key = array_pop( array_keys( $menu ) );
|
||||||
if ( 'wp-menu-separator' == $last_menu_item[ 4 ] )
|
if ( 'wp-menu-separator' == $menu[ $last_menu_key ][ 4 ] )
|
||||||
array_pop( $menu );
|
unset( $menu[ $last_menu_key ] );
|
||||||
reset( $menu );
|
unset( $last_menu_key );
|
||||||
unset( $last_menu_item );
|
|
||||||
|
|
||||||
if ( !user_can_access_admin_page() ) {
|
if ( !user_can_access_admin_page() ) {
|
||||||
do_action('admin_page_access_denied');
|
do_action('admin_page_access_denied');
|
||||||
|
Loading…
Reference in New Issue
Block a user