rest_after_insert_nav_menu_item action-hookWP 5.9.0

Fires after a single menu item is completely created or updated via the REST API.

Usage

add_action( 'rest_after_insert_nav_menu_item', 'wp_kama_rest_after_insert_nav_menu_item_action', 10, 3 );

/**
 * Function for `rest_after_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_after_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

WP_REST_Menu_Items_Controller::create_item()
rest_after_insert_nav_menu_item
WP_REST_Menu_Items_Controller::update_item()
rest_after_insert_nav_menu_item
wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php 182
do_action( 'rest_after_insert_nav_menu_item', $nav_menu_item, $request, true );
wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php 262
do_action( 'rest_after_insert_nav_menu_item', $nav_menu_item, $request, false );

Where the hook is used in WordPress

Usage not found.