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.
| Line | Code |
|---|---|
| 685 | * Returning a WP_Error value from the filter will short-circuit insertion and allow |
| 686 | * skipping further processing. |
| 687 | * |
| 688 | * @since 4.7.0 |
| 689 | * @since 4.8.0 `$prepared_comment` can now be a WP_Error to short-circuit insertion. |
| 690 | * |
| 691 | * @param array|WP_Error $prepared_comment The prepared comment data for wp_insert_comment(). |
| 692 | * @param WP_REST_Request $request Request used to insert the comment. |
| 693 | */ |
| 694 | $prepared_comment = apply_filters( 'rest_pre_insert_comment', $prepared_comment, $request ); |
| 695 | if ( is_wp_error( $prepared_comment ) ) { |
| 696 | return $prepared_comment; |
| 697 | } |
| 698 | |
| 699 | $comment_id = wp_insert_comment( wp_filter_comment( wp_slash( (array) $prepared_comment ) ) ); |
| 700 | |
| 701 | if ( ! $comment_id ) { |
| 702 | return new WP_Error( |
| 703 | 'rest_comment_failed_create', |