rest_pre_insert_nav_menu_item
Filters a menu item before it is inserted via the REST API.
Usage
add_filter( 'rest_pre_insert_nav_menu_item', 'wp_kama_rest_pre_insert_nav_menu_item_filter', 10, 2 ); /** * Function for `rest_pre_insert_nav_menu_item` filter-hook. * * @param object $prepared_nav_item An object representing a single menu item prepared for inserting or updating the database. * @param WP_REST_Request $request Request object. * * @return object */ function wp_kama_rest_pre_insert_nav_menu_item_filter( $prepared_nav_item, $request ){ // filter... return $prepared_nav_item; }
- $prepared_nav_item(object)
- An object representing a single menu item prepared for inserting or updating the database.
- $request(WP_REST_Request)
- Request object.
Changelog
Since 5.9.0 | Introduced. |
Where the hook is called
rest_pre_insert_nav_menu_item
wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php 481
return apply_filters( 'rest_pre_insert_nav_menu_item', $prepared_nav_item, $request );