rest_pre_insert_comment

rest_pre_insert_comment

Appears in: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Hook Type: filter
See hook in action

See hook in core

Displaying hooks found in version: wordpress-6.5.2

apply_filters('rest_pre_insert_comment') is found 1 times:

  • /wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php line 697
    		 *
    		 * @param array|WP_Error  $prepared_comment The prepared comment data for wp_insert_comment().
    		 * @param WP_REST_Request $request          Request used to insert the comment.
    		 */
    		$prepared_comment = apply_filters( 'rest_pre_insert_comment', $prepared_comment, $request );
    		if ( is_wp_error( $prepared_comment ) ) {
    			return $prepared_comment;
    		}
    
    		$comment_id = wp_insert_comment( wp_filter_comment( wp_slash( (array) $prepared_comment ) ) );
    
    

See this hook used in plugins: