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 |
---|---|
699 | * - `rest_insert_page` |
700 | * - `rest_insert_attachment` |
701 | * |
702 | * @since 4.7.0 |
703 | * |
704 | * @param WP_Post $post Inserted or updated post object. |
705 | * @param WP_REST_Request $request Request object. |
706 | * @param bool $creating True when creating a post, false when updating. |
707 | */ |
708 | do_action( "rest_insert_{$this->post_type}", $post, $request, true ); |
709 |
|
710 | $schema = $this->get_item_schema(); |
711 |
|
712 | if ( ! empty( $schema['properties']['sticky'] ) ) { |
713 | if ( ! empty( $request['sticky'] ) ) { |
714 | stick_post( $post_id ); |
715 | } else { |
716 | unstick_post( $post_id ); |
717 | } |
Line | Code |
885 | } else { |
886 | $post_id->add_data( array( 'status' => 400 ) ); |
887 | } |
888 | return $post_id; |
889 | } |
890 |
|
891 | $post = get_post( $post_id ); |
892 |
|
893 | /** This action is documented in wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php */ |
894 | do_action( "rest_insert_{$this->post_type}", $post, $request, false ); |
895 |
|
896 | $schema = $this->get_item_schema(); |
897 |
|
898 | if ( ! empty( $schema['properties']['format'] ) && ! empty( $request['format'] ) ) { |
899 | set_post_format( $post, $request['format'] ); |
900 | } |
901 |
|
902 | if ( ! empty( $schema['properties']['featured_media'] ) && isset( $request['featured_media'] ) ) { |
903 | $this->handle_featured_media( $request['featured_media'], $post_id ); |