Avoid a PHP notice on Edit Menus screen when a menu is attached to a non-existing location.
props nofearinc. fixes #26287. git-svn-id: https://develop.svn.wordpress.org/trunk@26634 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
ceb5e97102
commit
86d9ba6ada
@ -630,7 +630,9 @@ require_once( ABSPATH . 'wp-admin/admin-header.php' );
|
|||||||
if ( ! empty( $menu_locations ) && in_array( $_nav_menu->term_id, $menu_locations ) ) {
|
if ( ! empty( $menu_locations ) && in_array( $_nav_menu->term_id, $menu_locations ) ) {
|
||||||
$locations_assigned_to_this_menu = array();
|
$locations_assigned_to_this_menu = array();
|
||||||
foreach ( array_keys( $menu_locations, $_nav_menu->term_id ) as $menu_location_key ) {
|
foreach ( array_keys( $menu_locations, $_nav_menu->term_id ) as $menu_location_key ) {
|
||||||
$locations_assigned_to_this_menu[] = $locations[ $menu_location_key ];
|
if ( isset( $locations[ $menu_location_key ] ) ) {
|
||||||
|
$locations_assigned_to_this_menu[] = $locations[ $menu_location_key ];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -643,10 +645,12 @@ require_once( ABSPATH . 'wp-admin/admin-header.php' );
|
|||||||
$assigned_locations = array_slice( $locations_assigned_to_this_menu, 0, absint( apply_filters( 'wp_nav_locations_listed_per_menu', 3 ) ) );
|
$assigned_locations = array_slice( $locations_assigned_to_this_menu, 0, absint( apply_filters( 'wp_nav_locations_listed_per_menu', 3 ) ) );
|
||||||
|
|
||||||
// Adds ellipses following the number of locations defined in $assigned_locations
|
// Adds ellipses following the number of locations defined in $assigned_locations
|
||||||
printf( ' (%1$s%2$s)',
|
if ( ! empty( $assigned_locations ) ) {
|
||||||
implode( ', ', $assigned_locations ),
|
printf( ' (%1$s%2$s)',
|
||||||
count( $locations_assigned_to_this_menu ) > count( $assigned_locations ) ? ' …' : ''
|
implode( ', ', $assigned_locations ),
|
||||||
);
|
count( $locations_assigned_to_this_menu ) > count( $assigned_locations ) ? ' …' : ''
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</option>
|
</option>
|
||||||
|
Loading…
Reference in New Issue
Block a user