Changeset 16096
- Timestamp:
- 10/30/2010 12:13:45 AM (14 years ago)
- Location:
- trunk/wp-admin
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/admin-ajax.php
r16009 r16096 744 744 require_once ABSPATH . 'wp-admin/includes/nav-menu.php'; 745 745 746 $item_ids = wp_save_nav_menu_items( 0, $_POST['menu-item'] ); 746 /** 747 * For performance reasons, we omit some object properties from the checklist. 748 * The following is a hacky way to restore them when adding non-custom items. 749 */ 750 $menu_items_data = (array) $_POST['menu-item']; 751 $menu_item_data = array_shift( $menu_items_data ); 752 if ( 753 ! empty( $menu_item_data['menu-item-type'] ) && 754 'custom' != $menu_item_data['menu-item-type'] && 755 ! empty( $menu_item_data['menu-item-object-id'] ) 756 ) { 757 switch( $menu_item_data['menu-item-type'] ) { 758 case 'post_type' : 759 $_object = get_post( $menu_item_data['menu-item-object-id'] ); 760 break; 761 762 case 'taxonomy' : 763 $_object = get_term( $menu_item_data['menu-item-object-id'], $menu_item_data['menu-item-object'] ); 764 break; 765 } 766 767 $_menu_items = array_map( 'wp_setup_nav_menu_item', array( $_object ) ); 768 $_menu_item = array_shift( $_menu_items ); 769 770 /** Restore the missing menu item properties **/ 771 $menu_item_data['menu-item-description'] = $_menu_item->description; 772 773 $menu_items_data = array( $menu_item_data ); 774 } 775 776 $item_ids = wp_save_nav_menu_items( 0, $menu_items_data ); 747 777 if ( is_wp_error( $item_ids ) ) 748 778 die('-1'); -
trunk/wp-admin/includes/nav-menu.php
r16061 r16096 246 246 $output .= '<input type="hidden" class="menu-item-target" name="menu-item[' . $possible_object_id . '][menu-item-target]" value="'. esc_attr( $item->target ) .'" />'; 247 247 $output .= '<input type="hidden" class="menu-item-attr_title" name="menu-item[' . $possible_object_id . '][menu-item-attr_title]" value="'. esc_attr( $item->attr_title ) .'" />'; 248 $output .= '<input type="hidden" class="menu-item-description" name="menu-item[' . $possible_object_id . '][menu-item-description]" value="'. esc_attr( $item->description ) .'" />';249 248 $output .= '<input type="hidden" class="menu-item-classes" name="menu-item[' . $possible_object_id . '][menu-item-classes]" value="'. esc_attr( implode( ' ', $item->classes ) ) .'" />'; 250 249 $output .= '<input type="hidden" class="menu-item-xfn" name="menu-item[' . $possible_object_id . '][menu-item-xfn]" value="'. esc_attr( $item->xfn ) .'" />';
Note: See TracChangeset
for help on using the changeset viewer.