WordPress at a glance
filter is not described

rest_pre_insert_comment filter-hook . WP 4.7.0

Filters a comment before it is inserted via the REST API.

Allows modification of the comment right before it is inserted via wp_insert_comment(). Returning a WP_Error value from the filter will short-circuit insertion and allow skipping further processing.


add_filter( 'rest_pre_insert_comment', 'filter_function_name_8479', 10, 2 );
function filter_function_name_8479( $prepared_comment, $request ){
	// filter...

	return $prepared_comment;
The prepared comment data for wp_insert_comment().
Request used to insert the comment.

Список изменений

С версии 4.7.0 Введена.
С версии 4.8.0 $prepared_comment can now be a WP_Error to short-circuit insertion.

Где вызывается хук

wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php 694
$prepared_comment = apply_filters( 'rest_pre_insert_comment', $prepared_comment, $request );

Где используется хук в ядре WP

Использование не найдено.