Filter hook 'wp_update_comment_data'

in WP Core File wp-includes/comment.php at line 2625

View Source

wp_update_comment_data

Filter Hook
Description
Filters the comment data immediately before it is updated in the database. Note: data being passed to the filter is already unslashed. and allow skipping further processing.

Hook Information

File Location wp-includes/comment.php View on GitHub
Hook Type Filter
Line Number 2625

Hook Parameters

Type Name Description
array|WP_Error $data The new, processed comment data, or WP_Error.
array $comment The old, unslashed comment data.
array $commentarr The new, raw comment data.

Usage Examples

Basic Usage
<?php
// Hook into wp_update_comment_data
add_filter('wp_update_comment_data', 'my_custom_filter', 10, 3);

function my_custom_filter($data, $comment, $commentarr) {
    // Your custom filtering logic here
    return $data;
}

Source Code Context

wp-includes/comment.php:2625 - How this hook is used in WordPress core
<?php
2620  	 *
2621  	 * @param array|WP_Error $data       The new, processed comment data, or WP_Error.
2622  	 * @param array          $comment    The old, unslashed comment data.
2623  	 * @param array          $commentarr The new, raw comment data.
2624  	 */
2625  	$data = apply_filters( 'wp_update_comment_data', $data, $comment, $commentarr );
2626  
2627  	// Do not carry on on failure.
2628  	if ( is_wp_error( $data ) ) {
2629  		if ( $wp_error ) {
2630  			return $data;

PHP Documentation

<?php
/**
	 * Filters the comment data immediately before it is updated in the database.
	 *
	 * Note: data being passed to the filter is already unslashed.
	 *
	 * @since 4.7.0
	 * @since 5.5.0 Returning a WP_Error value from the filter will short-circuit comment update
	 *              and allow skipping further processing.
	 *
	 * @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.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 3
  • File: wp-includes/comment.php
Related Hooks

Related hooks will be displayed here in future updates.