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 |
---|---|
611 | * |
612 | * The dynamic portion of the hook name, `$this->post_type`, refers to the post type slug. |
613 | * |
614 | * @since 4.7.0 |
615 | * |
616 | * @param WP_Post $post Inserted or updated post object. |
617 | * @param WP_REST_Request $request Request object. |
618 | * @param bool $creating True when creating a post, false when updating. |
619 | */ |
620 | do_action( "rest_insert_{$this->post_type}", $post, $request, true ); |
621 |
|
622 | $schema = $this->get_item_schema(); |
623 |
|
624 | if ( ! empty( $schema['properties']['sticky'] ) ) { |
625 | if ( ! empty( $request['sticky'] ) ) { |
626 | stick_post( $post_id ); |
627 | } else { |
628 | unstick_post( $post_id ); |
629 | } |
Line | Code |
766 | } else { |
767 | $post_id->add_data( array( 'status' => 400 ) ); |
768 | } |
769 | return $post_id; |
770 | } |
771 |
|
772 | $post = get_post( $post_id ); |
773 |
|
774 | /** This action is documented in wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php */ |
775 | do_action( "rest_insert_{$this->post_type}", $post, $request, false ); |
776 |
|
777 | $schema = $this->get_item_schema(); |
778 |
|
779 | if ( ! empty( $schema['properties']['format'] ) && ! empty( $request['format'] ) ) { |
780 | set_post_format( $post, $request['format'] ); |
781 | } |
782 |
|
783 | if ( ! empty( $schema['properties']['featured_media'] ) && isset( $request['featured_media'] ) ) { |
784 | $this->handle_featured_media( $request['featured_media'], $post_id ); |