mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-13 02:51:33 +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.
|
// 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.
|
// The following is a hacky way to restore them when adding non-custom items.
|
||||||
|
|
||||||
$menu_items_data = (array) $_POST['menu-item'];
|
$menu_items_data = array();
|
||||||
$menu_item_data = array_shift( $menu_items_data );
|
foreach ( (array) $_POST['menu-item'] as $menu_item_data ) {
|
||||||
if (
|
if (
|
||||||
! empty( $menu_item_data['menu-item-type'] ) &&
|
! empty( $menu_item_data['menu-item-type'] ) &&
|
||||||
'custom' != $menu_item_data['menu-item-type'] &&
|
'custom' != $menu_item_data['menu-item-type'] &&
|
||||||
! empty( $menu_item_data['menu-item-object-id'] )
|
! empty( $menu_item_data['menu-item-object-id'] )
|
||||||
) {
|
) {
|
||||||
switch( $menu_item_data['menu-item-type'] ) {
|
switch( $menu_item_data['menu-item-type'] ) {
|
||||||
case 'post_type' :
|
case 'post_type' :
|
||||||
$_object = get_post( $menu_item_data['menu-item-object-id'] );
|
$_object = get_post( $menu_item_data['menu-item-object-id'] );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'taxonomy' :
|
case 'taxonomy' :
|
||||||
$_object = get_term( $menu_item_data['menu-item-object-id'], $menu_item_data['menu-item-object'] );
|
$_object = get_term( $menu_item_data['menu-item-object-id'], $menu_item_data['menu-item-object'] );
|
||||||
break;
|
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_items_data[] = $menu_item_data;
|
||||||
$_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 );
|
|
||||||
|
|
||||||
$item_ids = wp_save_nav_menu_items( 0, $menu_items_data );
|
$item_ids = wp_save_nav_menu_items( 0, $menu_items_data );
|
||||||
if ( is_wp_error( $item_ids ) )
|
if ( is_wp_error( $item_ids ) )
|
||||||
|
Loading…
Reference in New Issue
Block a user