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 |
---|---|
726 | * - `rest_after_insert_page` |
727 | * - `rest_after_insert_attachment` |
728 | * |
729 | * @since 5.0.0 |
730 | * |
731 | * @param WP_Post $post Inserted or updated post object. |
732 | * @param WP_REST_Request $request Request object. |
733 | * @param bool $creating True when creating a post, false when updating. |
734 | */ |
735 | do_action( "rest_after_insert_{$this->post_type}", $post, $request, true ); |
736 |
|
737 | wp_after_insert_post( $post, false, null ); |
738 |
|
739 | $response = $this->prepare_item_for_response( $post, $request ); |
740 | $response = rest_ensure_response( $response ); |
741 |
|
742 | $response->set_status( 201 ); |
743 | $response->header( 'Location', rest_url( sprintf( '%s/%s/%d', $this->namespace, $this->rest_base, $post_id ) ) ); |
744 |
|
Line | Code |
880 | $request->set_param( 'context', 'edit' ); |
881 |
|
882 | // Filter is fired in WP_REST_Attachments_Controller subclass. |
883 | if ( 'attachment' === $this->post_type ) { |
884 | $response = $this->prepare_item_for_response( $post, $request ); |
885 | return rest_ensure_response( $response ); |
886 | } |
887 |
|
888 | /** This action is documented in wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php */ |
889 | do_action( "rest_after_insert_{$this->post_type}", $post, $request, false ); |
890 |
|
891 | wp_after_insert_post( $post, true, $post_before ); |
892 |
|
893 | $response = $this->prepare_item_for_response( $post, $request ); |
894 |
|
895 | return rest_ensure_response( $response ); |
896 | } |
897 |
|
898 | /** |