duplicate_comment_id

Filters the ID, if any, of the duplicate comment found when creating a new comment.

Description

apply_filters( 'duplicate_comment_id', (int) $dupe_id, (array) $commentdata ); 

Return an empty value from this filter to allow what WP considers a duplicate comment.

Parameters (2)

0. $dupe_id (int)
ID of the comment identified as a duplicate.
1. $commentdata (array)
Data for the comment being created.

Usage

To run the hook, copy the example below.
  1. $dupe_id = apply_filters( 'duplicate_comment_id', $dupe_id, $commentdata ); 
  2.  
  3. if ( !empty( $dupe_id ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the duplicate_comment_id callback 
  2. function filter_duplicate_comment_id( $dupe_id, $commentdata ) { 
  3. // make filter magic happen here... 
  4. return $dupe_id
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'duplicate_comment_id', 'filter_duplicate_comment_id', 10, 2 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'duplicate_comment_id', 'filter_duplicate_comment_id', 10, 2 ); 

Defined (1)

The filter is defined in the following location(s).

/wp-includes/comment.php  
  1. $dupe_id = apply_filters( 'duplicate_comment_id', $dupe_id, $commentdata );