rest_insert_nav_menu_item
Fires after a single menu item is created or updated via the REST API.
Usage
add_action( 'rest_insert_nav_menu_item', 'wp_kama_rest_insert_nav_menu_item_action', 10, 3 ); /** * Function for `rest_insert_nav_menu_item` action-hook. * * @param object $nav_menu_item Inserted or updated menu item object. * @param WP_REST_Request $request Request object. * @param bool $creating True when creating a menu item, false when updating. * * @return void */ function wp_kama_rest_insert_nav_menu_item_action( $nav_menu_item, $request, $creating ){ // action... }
- $nav_menu_item(object)
- Inserted or updated menu item object.
- $request(WP_REST_Request)
- Request object.
- $creating(true|false)
- True when creating a menu item, false when updating.
Changelog
Since 5.9.0 | Introduced. |
Where the hook is called
rest_insert_nav_menu_item
rest_insert_nav_menu_item
wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php 151
do_action( 'rest_insert_nav_menu_item', $nav_menu_item, $request, true );
wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php 237
do_action( 'rest_insert_nav_menu_item', $nav_menu_item, $request, false );