WordPress.org

Make WordPress Core

Ticket #18085: menu.php.diff

File menu.php.diff, 785 bytes (added by ansimation, 7 years ago)

patch for menu.php

  • wp-admin/includes/menu.php

     
    216216
    217217// Remove the last menu item if it is a separator.
    218218$last_menu_key = array_pop( array_keys( $menu ) );
    219 if ( 'wp-menu-separator' == $menu[ $last_menu_key ][ 4 ] )
    220         unset( $menu[ $last_menu_key ] );
    221 unset( $last_menu_key );
    222219
     220if( ! is_null( $last_menu_key ) )
     221{
     222    if ( 'wp-menu-separator' == $menu[ $last_menu_key ][ 4 ] )
     223            unset( $menu[ $last_menu_key ] );
     224    unset( $last_menu_key );
     225}
     226
    223227if ( !user_can_access_admin_page() ) {
    224228        do_action('admin_page_access_denied');
    225229        wp_die( __('You do not have sufficient permissions to access this page.') );