WPDev.one
Core Function
View Source on Trac ↗

wp_update_nav_menu_item()

wp_update_nav_menu_item( mixed $menu_id = 0, mixed $menu_item_db_id = 0, mixed $menu_item_data = array(), mixed $fire_after_hooks = true )

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

Parameters 0 required

Name / Type Description
$menu_id
int

The ID of the menu. If 0, makes the menu item a draft orphan.

$menu_item_db_id
int

The ID of the menu item. If 0, creates a new menu item.

$menu_item_data
array

The menu item's data.

$fire_after_hooks
bool

Whether to fire the after insert hooks. Default true.

Return Value

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

Function Information

Since Version
3.0.0
Source File
wp-includes/nav-menu.php
Advertisement