wp_add_nav_menu_item
Fires immediately after a new navigation menu item has been added.
Usage
add_action( 'wp_add_nav_menu_item', 'wp_kama_add_nav_menu_item_action', 10, 3 ); /** * Function for `wp_add_nav_menu_item` action-hook. * * @param int $menu_id ID of the updated menu. * @param int $menu_item_db_id ID of the new menu item. * @param array $args An array of arguments used to update/add the menu item. * * @return void */ function wp_kama_add_nav_menu_item_action( $menu_id, $menu_item_db_id, $args ){ // action... }
- $menu_id(int)
- ID of the updated menu.
- $menu_item_db_id(int)
- ID of the new menu item.
- $args(array)
- An array of arguments used to update/add the menu item.
Changelog
Since 4.4.0 | Introduced. |
Where the hook is called
wp_add_nav_menu_item
wp-includes/nav-menu.php 565
do_action( 'wp_add_nav_menu_item', $menu_id, $menu_item_db_id, $args );