Save the properties of a menu item or create a new one.

Signature

wp_update_nav_menu_item( $menu_id = 0, $menu_item_db_id = 0, $menu_item_data = array() )
menu_id
 (int) The ID of the menu. Required. If "0", makes the menu item a draft orphan.
Default: 0
menu_item_db_id
 (int) The ID of the menu item. If "0", creates a new menu item.
Default: 0
menu_item_data
 (array) The menu item's data.
Default: array()

Return

(int) The menu item's database ID or WP_Error object on failure.

Source

function wp_update_nav_menu_item( $menu_id = 0, $menu_item_db_id = 0, $menu_item_data = array() ) {
	$menu_id = (int) $menu_id;
	$menu_item_db_id = (int) $menu_item_db_id;

	// make sure that we don't convert non-nav_menu_item objects into nav_menu_item objects
	if ( ! empty( $menu_item_db_id ) && ! is_nav_menu_item( $menu_item_db_id ) )
		return new WP_Error('update_nav_menu_item_failed', __('The given object ID is not that of a menu item.'));

	$menu = wp_get_nav_menu_object( $menu_id );

	if ( ( ! $menu && 0 !== $menu_id ) || is_wp_error( $menu ) )
		return $menu;

	$defaults = array(
		'menu-item-db-id' => $menu_item_db_id,
		'menu-item-object-id' => 0,
		'menu-item-object' => '',
		'menu-item-parent-id' => 0,
		'menu-item-position' => 0,
		'menu-item-type' => 'custom',
110 more lines...
WP Trac GitHub

Link here