wp_update_nav_menu_item
wp_update_nav_menu_item ( $menu_id = 0, $menu_item_db_id = 0, $menu_item_data = array(), $fire_after_hooks = true )
Parameters:- (int) menu_id The ID of the menu. If 0, makes the menu item a draft orphan.
- (int) menu_item_db_id The ID of the menu item. If 0, creates a new menu item.
- (array) menu_item_data The menu item's data.
- (bool) fire_after_hooks Whether to fire the after insert hooks. Default true.
Returns:- (int|WP_Error) The menu item's database ID or WP_Error object on failure.
Defined at:Change Log: - Introduced in WordPress: 3.0.0
- Deprecated in WordPress: —
Description
Saves the properties of a menu item or create a new one.The menu-item-title, menu-item-description and menu-item-attr-title are expected
to be pre-slashed since they are passed directly to APIs that expect slashed data.