Make WordPress Core

Ticket #26287: 26287.diff

File 26287.diff, 1.4 KB (added by nofearinc, 12 years ago)

verify for existing menu location

  • wp-admin/nav-menus.php

     
    630630                                                if ( ! empty( $menu_locations ) && in_array( $_nav_menu->term_id, $menu_locations ) ) {
    631631                                                        $locations_assigned_to_this_menu = array();
    632632                                                        foreach ( array_keys( $menu_locations, $_nav_menu->term_id ) as $menu_location_key ) {
    633                                                                  $locations_assigned_to_this_menu[] = $locations[ $menu_location_key ];
     633                                                                if ( isset( $locations[ $menu_location_key ] ) ) {
     634                                                                        $locations_assigned_to_this_menu[] = $locations[ $menu_location_key ];
     635                                                                }
    634636                                                        }
    635637
    636638                                                        /**
     
    643645                                                        $assigned_locations = array_slice( $locations_assigned_to_this_menu, 0, absint( apply_filters( 'wp_nav_locations_listed_per_menu', 3 ) ) );
    644646
    645647                                                        // Adds ellipses following the number of locations defined in $assigned_locations
    646                                                         printf( ' (%1$s%2$s)',
    647                                                                 implode( ', ', $assigned_locations ),
    648                                                                 count( $locations_assigned_to_this_menu ) > count( $assigned_locations ) ? ' …' : ''
    649                                                         );
     648                                                        if ( ! empty( $assigned_locations ) ) {
     649                                                                printf( ' (%1$s%2$s)',
     650                                                                        implode( ', ', $assigned_locations ),
     651                                                                        count( $locations_assigned_to_this_menu ) > count( $assigned_locations ) ? ' …' : ''
     652                                                                );
     653                                                        }
    650654                                                }
    651655                                                ?>
    652656                                        </option>