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