Does anyone know how to disable duplicate comment detection in Wordpress (2.9.2)? I'm looking for a way to do this programatically without editing core files. We're adding comments via XMLRPC and the duplicate detection in wp-includes/comment.php (line 494) is causing issues during testing.
Thanks!
Actually, you don't need to edit ANY core files to do this. Just put these one filter and two tiny functions in your theme's functions.php
file and duplicate comments will no longer be rejected.
add_filter( 'wp_die_handler', 'my_wp_die_handler_function', 9 ); //9 means you can unhook the default before it fires
function my_wp_die_handler_function($function) {
return 'my_skip_dupes_function'; //use our "die" handler instead (where we won't die)
}
//check to make sure we're only filtering out die requests for the "Duplicate" error we care about
function my_skip_dupes_function( $message, $title, $args ) {
if (strpos( $message, 'Duplicate comment detected' ) === 0 ) { //make sure we only prevent death on the $dupe check
remove_filter( 'wp_die_handler', '_default_wp_die_handler' ); //don't die
}
return; //nothing will happen
}
Currently, there are no hooks available to do this without editing core files.
The best way would be to comment out the duplicate check from wp-includes/comment.php
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With