Ticket #14415: 14415.fix.multi.items.diff
File 14415.fix.multi.items.diff, 2.2 KB (added by , 14 years ago) |
---|
-
wp-admin/admin-ajax.php
746 746 // For performance reasons, we omit some object properties from the checklist. 747 747 // The following is a hacky way to restore them when adding non-custom items. 748 748 749 $menu_items_data = (array) $_POST['menu-item'];750 $menu_item_data = array_shift( $menu_items_data );751 if (752 ! empty( $menu_item_data['menu-item-type'] ) &&753 'custom' != $menu_item_data['menu-item-type'] &&754 ! empty( $menu_item_data['menu-item-object-id'] )755 ) {756 switch( $menu_item_data['menu-item-type'] ) {757 case 'post_type' :758 $_object = get_post( $menu_item_data['menu-item-object-id'] );759 break;749 $menu_items_data = array(); 750 foreach ( (array) $_POST['menu-item'] as $menu_item_data ) { 751 if ( 752 ! empty( $menu_item_data['menu-item-type'] ) && 753 'custom' != $menu_item_data['menu-item-type'] && 754 ! empty( $menu_item_data['menu-item-object-id'] ) 755 ) { 756 switch( $menu_item_data['menu-item-type'] ) { 757 case 'post_type' : 758 $_object = get_post( $menu_item_data['menu-item-object-id'] ); 759 break; 760 760 761 case 'taxonomy' :762 $_object = get_term( $menu_item_data['menu-item-object-id'], $menu_item_data['menu-item-object'] );763 break;764 }761 case 'taxonomy' : 762 $_object = get_term( $menu_item_data['menu-item-object-id'], $menu_item_data['menu-item-object'] ); 763 break; 764 } 765 765 766 $_menu_items = array_map( 'wp_setup_nav_menu_item', array( $_object ) );767 $_menu_item = array_shift( $_menu_items );766 $_menu_items = array_map( 'wp_setup_nav_menu_item', array( $_object ) ); 767 $_menu_item = array_shift( $_menu_items ); 768 768 769 // Restore the missing menu item properties 770 $menu_item_data['menu-item-description'] = $_menu_item->description; 771 } 769 // Restore the missing menu item properties 770 $menu_item_data['menu-item-description'] = $_menu_item->description; 771 } 772 773 $menu_items_data[] = $menu_item_data; 774 } 772 775 773 $menu_items_data = array( $menu_item_data );774 775 776 $item_ids = wp_save_nav_menu_items( 0, $menu_items_data ); 776 777 if ( is_wp_error( $item_ids ) ) 777 778 die('-1');