wp_update_comment_data хук-фильтрWP 4.7.0

Filters the comment data immediately before it is updated in the database.

Note: data being passed to the filter is already unslashed.

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

add_filter( 'wp_update_comment_data', 'wp_kama_update_comment_data_filter', 10, 3 );

/**
 * Function for `wp_update_comment_data` filter-hook.
 * 
 * @param array|WP_Error $data       The new, processed comment data, or WP_Error.
 * @param array          $comment    The old, unslashed comment data.
 * @param array          $commentarr The new, raw comment data.
 *
 * @return array|WP_Error
 */
function wp_kama_update_comment_data_filter( $data, $comment, $commentarr ){

	// filter...
	return $data;
}
$data(массив|WP_Error)
The new, processed comment data, or WP_Error.
$comment(массив)
The old, unslashed comment data.
$commentarr(массив)
The new, raw comment data.

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

С версии 4.7.0 Введена.
С версии 5.5.0 Returning a WP_Error value from the filter will short-circuit comment update and allow skipping further processing.

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

wp_update_comment()
wp_update_comment_data
wp-includes/comment.php 2565
$data = apply_filters( 'wp_update_comment_data', $data, $comment, $commentarr );

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

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