else { $parent_db_id = 0;
} $parent_object =
wp_setup_nav_menu_item( get_post( $parent_db_id ) );
if ( !
is_wp_error( $parent_object ) ) { $parent_data =
(array) $parent_object;
$menu_item_data['menu_item_parent'
] =
$parent_data['menu_item_parent'
];
// Reset invalid `menu_item_parent`.
$menu_item_data =
_wp_reset_invalid_menu_item_parent( $menu_item_data );
update_post_meta( $menu_item_data['ID'
], '_menu_item_menu_item_parent',
(int) $menu_item_data['menu_item_parent'
] );
} // Make menu item a child of its next sibling.
} else { $next_item_data['menu_order'
] =
$next_item_data['menu_order'
] - 1;
$menu_item_data['menu_order'
] =
$menu_item_data['menu_order'
] + 1;
$menu_item_data['menu_item_parent'
] =
$next_item_data['ID'
];