mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-12 18:42:03 +01:00
Fix regression introduced by [16096]. Props duck_. See #14415
git-svn-id: http://svn.automattic.com/wordpress/trunk@16105 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
a512dbefb2
commit
26a0767138
@ -746,31 +746,32 @@ case 'add-menu-item' :
|
||||
// For performance reasons, we omit some object properties from the checklist.
|
||||
// The following is a hacky way to restore them when adding non-custom items.
|
||||
|
||||
$menu_items_data = (array) $_POST['menu-item'];
|
||||
$menu_item_data = array_shift( $menu_items_data );
|
||||
if (
|
||||
! empty( $menu_item_data['menu-item-type'] ) &&
|
||||
'custom' != $menu_item_data['menu-item-type'] &&
|
||||
! empty( $menu_item_data['menu-item-object-id'] )
|
||||
) {
|
||||
switch( $menu_item_data['menu-item-type'] ) {
|
||||
case 'post_type' :
|
||||
$_object = get_post( $menu_item_data['menu-item-object-id'] );
|
||||
break;
|
||||
$menu_items_data = array();
|
||||
foreach ( (array) $_POST['menu-item'] as $menu_item_data ) {
|
||||
if (
|
||||
! empty( $menu_item_data['menu-item-type'] ) &&
|
||||
'custom' != $menu_item_data['menu-item-type'] &&
|
||||
! empty( $menu_item_data['menu-item-object-id'] )
|
||||
) {
|
||||
switch( $menu_item_data['menu-item-type'] ) {
|
||||
case 'post_type' :
|
||||
$_object = get_post( $menu_item_data['menu-item-object-id'] );
|
||||
break;
|
||||
|
||||
case 'taxonomy' :
|
||||
$_object = get_term( $menu_item_data['menu-item-object-id'], $menu_item_data['menu-item-object'] );
|
||||
break;
|
||||
case 'taxonomy' :
|
||||
$_object = get_term( $menu_item_data['menu-item-object-id'], $menu_item_data['menu-item-object'] );
|
||||
break;
|
||||
}
|
||||
|
||||
$_menu_items = array_map( 'wp_setup_nav_menu_item', array( $_object ) );
|
||||
$_menu_item = array_shift( $_menu_items );
|
||||
|
||||
// Restore the missing menu item properties
|
||||
$menu_item_data['menu-item-description'] = $_menu_item->description;
|
||||
}
|
||||
|
||||
$_menu_items = array_map( 'wp_setup_nav_menu_item', array( $_object ) );
|
||||
$_menu_item = array_shift( $_menu_items );
|
||||
|
||||
// Restore the missing menu item properties
|
||||
$menu_item_data['menu-item-description'] = $_menu_item->description;
|
||||
}
|
||||
|
||||
$menu_items_data = array( $menu_item_data );
|
||||
|
||||
$menu_items_data[] = $menu_item_data;
|
||||
}
|
||||
|
||||
$item_ids = wp_save_nav_menu_items( 0, $menu_items_data );
|
||||
if ( is_wp_error( $item_ids ) )
|
||||
|
Loading…
Reference in New Issue
Block a user