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 |
---|---|
718 | * Fires after a comment is created or updated via the REST API. |
719 | * |
720 | * @since 4.7.0 |
721 | * |
722 | * @param WP_Comment $comment Inserted or updated comment object. |
723 | * @param WP_REST_Request $request Request object. |
724 | * @param bool $creating True when creating a comment, false |
725 | * when updating. |
726 | */ |
727 | do_action( 'rest_insert_comment', $comment, $request, true ); |
728 |
|
729 | $schema = $this->get_item_schema(); |
730 |
|
731 | if ( ! empty( $schema['properties']['meta'] ) && isset( $request['meta'] ) ) { |
732 | $meta_update = $this->meta->update_value( $request['meta'], $comment_id ); |
733 |
|
734 | if ( is_wp_error( $meta_update ) ) { |
735 | return $meta_update; |
736 | } |
Line | Code |
882 |
|
883 | if ( isset( $request['status'] ) ) { |
884 | $this->handle_status_param( $request['status'], $id ); |
885 | } |
886 | } |
887 |
|
888 | $comment = get_comment( $id ); |
889 |
|
890 | /** This action is documented in wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php */ |
891 | do_action( 'rest_insert_comment', $comment, $request, false ); |
892 |
|
893 | $schema = $this->get_item_schema(); |
894 |
|
895 | if ( ! empty( $schema['properties']['meta'] ) && isset( $request['meta'] ) ) { |
896 | $meta_update = $this->meta->update_value( $request['meta'], $id ); |
897 |
|
898 | if ( is_wp_error( $meta_update ) ) { |
899 | return $meta_update; |
900 | } |