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 |
---|---|
639 | * Fires completely after a comment is created or updated via the REST API. |
640 | * |
641 | * @since 5.0.0 |
642 | * |
643 | * @param WP_Comment $comment Inserted or updated comment object. |
644 | * @param WP_REST_Request $request Request object. |
645 | * @param bool $creating True when creating a comment, false |
646 | * when updating. |
647 | */ |
648 | do_action( 'rest_after_insert_comment', $comment, $request, true ); |
649 |
|
650 | $response = $this->prepare_item_for_response( $comment, $request ); |
651 | $response = rest_ensure_response( $response ); |
652 |
|
653 | $response->set_status( 201 ); |
654 | $response->header( 'Location', rest_url( sprintf( '%s/%s/%d', $this->namespace, $this->rest_base, $comment_id ) ) ); |
655 |
|
656 | return $response; |
657 | } |
Line | Code |
763 | $fields_update = $this->update_additional_fields_for_object( $comment, $request ); |
764 |
|
765 | if ( is_wp_error( $fields_update ) ) { |
766 | return $fields_update; |
767 | } |
768 |
|
769 | $request->set_param( 'context', 'edit' ); |
770 |
|
771 | /** This action is documented in wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php */ |
772 | do_action( 'rest_after_insert_comment', $comment, $request, false ); |
773 |
|
774 | $response = $this->prepare_item_for_response( $comment, $request ); |
775 |
|
776 | return rest_ensure_response( $response ); |
777 | } |
778 |
|
779 | /** |
780 | * Checks if a given request has access to delete a comment. |
781 | * |