WP hooks navigation: Home/browse • Actions index • Filters index
To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).
The best way to understand what a hook does is to look at where it occurs in the source code.
do_action( "hook_name" )
apply_filters( "hook_name", "what_to_filter" )
.Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.
This hook occurs 2 times in this file.
Line | Code |
---|---|
143 | /** |
144 | * Fires after a single menu item is created or updated via the REST API. |
145 | * |
146 | * @since 5.9.0 |
147 | * |
148 | * @param object $nav_menu_item Inserted or updated menu item object. |
149 | * @param WP_REST_Request $request Request object. |
150 | * @param bool $creating True when creating a menu item, false when updating. |
151 | */ |
152 | do_action( 'rest_insert_nav_menu_item', $nav_menu_item, $request, true ); |
153 |
|
154 | $schema = $this->get_item_schema(); |
155 |
|
156 | if ( ! empty( $schema['properties']['meta'] ) && isset( $request['meta'] ) ) { |
157 | $meta_update = $this->meta->update_value( $request['meta'], $nav_menu_item_id ); |
158 |
|
159 | if ( is_wp_error( $meta_update ) ) { |
160 | return $meta_update; |
161 | } |
Line | Code |
230 |
|
231 | $nav_menu_item = $this->get_nav_menu_item( $nav_menu_item_id ); |
232 | if ( is_wp_error( $nav_menu_item ) ) { |
233 | $nav_menu_item->add_data( array( 'status' => 404 ) ); |
234 |
|
235 | return $nav_menu_item; |
236 | } |
237 |
|
238 | /** This action is documented in wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php */ |
239 | do_action( 'rest_insert_nav_menu_item', $nav_menu_item, $request, false ); |
240 |
|
241 | $schema = $this->get_item_schema(); |
242 |
|
243 | if ( ! empty( $schema['properties']['meta'] ) && isset( $request['meta'] ) ) { |
244 | $meta_update = $this->meta->update_value( $request['meta'], $nav_menu_item->ID ); |
245 |
|
246 | if ( is_wp_error( $meta_update ) ) { |
247 | return $meta_update; |
248 | } |