wp_update_comment_data filter-hookWP 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.

Usage

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(array|WP_Error)
The new, processed comment data, or WP_Error.
$comment(array)
The old, unslashed comment data.
$commentarr(array)
The new, raw comment data.

Changelog

Since 4.7.0 Introduced.
Since 5.5.0 Returning a WP_Error value from the filter will short-circuit comment update and allow skipping further processing.

Where the hook is called

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

Where the hook is used in WordPress

Usage not found.