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 |
---|---|
317 | $fields_update = $this->update_additional_fields_for_object( $template, $request ); |
318 | if ( is_wp_error( $fields_update ) ) { |
319 | return $fields_update; |
320 | } |
321 |
|
322 | $request->set_param( 'context', 'edit' ); |
323 |
|
324 | $post = get_post( $template->wp_id ); |
325 | /** This action is documented in wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php */ |
326 | do_action( "rest_after_insert_{$this->post_type}", $post, $request, false ); |
327 |
|
328 | wp_after_insert_post( $post, $update, $post_before ); |
329 |
|
330 | $response = $this->prepare_item_for_response( $template, $request ); |
331 |
|
332 | return rest_ensure_response( $response ); |
333 | } |
334 |
|
335 | /** |
Line | Code |
377 | $id = $posts[0]->id; |
378 | $post = get_post( $post_id ); |
379 | $template = get_block_template( $id, $this->post_type ); |
380 | $fields_update = $this->update_additional_fields_for_object( $template, $request ); |
381 | if ( is_wp_error( $fields_update ) ) { |
382 | return $fields_update; |
383 | } |
384 |
|
385 | /** This action is documented in wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php */ |
386 | do_action( "rest_after_insert_{$this->post_type}", $post, $request, true ); |
387 |
|
388 | wp_after_insert_post( $post, false, null ); |
389 |
|
390 | $response = $this->prepare_item_for_response( $template, $request ); |
391 | $response = rest_ensure_response( $response ); |
392 |
|
393 | $response->set_status( 201 ); |
394 | $response->header( 'Location', rest_url( sprintf( '%s/%s/%s', $this->namespace, $this->rest_base, $template->id ) ) ); |
395 |
|