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 |
---|---|
172 | /** |
173 | * Fires after a single menu item is completely created or updated via the REST API. |
174 | * |
175 | * @since 5.9.0 |
176 | * |
177 | * @param object $nav_menu_item Inserted or updated menu item object. |
178 | * @param WP_REST_Request $request Request object. |
179 | * @param bool $creating True when creating a menu item, false when updating. |
180 | */ |
181 | do_action( 'rest_after_insert_nav_menu_item', $nav_menu_item, $request, true ); |
182 |
|
183 | $post = get_post( $nav_menu_item_id ); |
184 | wp_after_insert_post( $post, false, null ); |
185 |
|
186 | $response = $this->prepare_item_for_response( $post, $request ); |
187 | $response = rest_ensure_response( $response ); |
188 |
|
189 | $response->set_status( 201 ); |
190 | $response->header( 'Location', rest_url( sprintf( '%s/%s/%d', $this->namespace, $this->rest_base, $nav_menu_item_id ) ) ); |
Line | Code |
251 | $fields_update = $this->update_additional_fields_for_object( $nav_menu_item, $request ); |
252 |
|
253 | if ( is_wp_error( $fields_update ) ) { |
254 | return $fields_update; |
255 | } |
256 |
|
257 | $request->set_param( 'context', 'edit' ); |
258 |
|
259 | /** This action is documented in wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php */ |
260 | do_action( 'rest_after_insert_nav_menu_item', $nav_menu_item, $request, false ); |
261 |
|
262 | wp_after_insert_post( $post, true, $post_before ); |
263 |
|
264 | $response = $this->prepare_item_for_response( get_post( $nav_menu_item_id ), $request ); |
265 |
|
266 | return rest_ensure_response( $response ); |
267 | } |
268 |
|
269 | /** |