Filter hook 'duplicate_comment_id'

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

View Source

duplicate_comment_id

Filter Hook
Description
Filters the ID, if any, of the duplicate comment found when creating a new comment. Return an empty value from this filter to allow what WP considers a duplicate comment.

Hook Information

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

Hook Parameters

Type Name Description
int $dupe_id ID of the comment identified as a duplicate.
array $commentdata Data for the comment being created.

Usage Examples

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

function my_custom_filter($dupe_id, $commentdata) {
    // Your custom filtering logic here
    return $dupe_id;
}

Source Code Context

wp-includes/comment.php:721 - How this hook is used in WordPress core
<?php
 716  	 * @since 4.4.0
 717  	 *
 718  	 * @param int   $dupe_id     ID of the comment identified as a duplicate.
 719  	 * @param array $commentdata Data for the comment being created.
 720  	 */
 721  	$dupe_id = apply_filters( 'duplicate_comment_id', $dupe_id, $commentdata );
 722  
 723  	if ( $dupe_id ) {
 724  		/**
 725  		 * Fires immediately after a duplicate comment is detected.
 726  		 *

PHP Documentation

<?php
/**
	 * Filters the ID, if any, of the duplicate comment found when creating a new comment.
	 *
	 * Return an empty value from this filter to allow what WP considers a duplicate comment.
	 *
	 * @since 4.4.0
	 *
	 * @param int   $dupe_id     ID of the comment identified as a duplicate.
	 * @param array $commentdata Data for the comment being created.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/comment.php
Related Hooks

Related hooks will be displayed here in future updates.