• Resolved TIEro

    (@tiero)


    Hi,

    I’d like to allow duplicate comments on a site I’m creating (for system messages posted as comments). I’ve found a core hack (no thanks), an md5 workaround (prefer not to) and one person who offers a hook solution (yes, please).

    The hook solution is here: http://mrtwebdesign.com/disable-duplicate-comment-detection-for-pages-and-posts/

    But it doesn’t work. I put the line of code into my plugin and my theme (separately), but it doesn’t do anything:

    remove_filter(‘commentdata’,’comment_duplicate_trigger’);

    Still get the duplicate comment error message. Can anyone point me in the direction of a fix, please?

    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter TIEro

    (@tiero)

    More research, found it on StackExchange (as usual):

    http://stackoverflow.com/questions/2943036/wordpress-duplicate-comment-detection

    It’s still a workaround, but functions by killing the wp_die gag response. tested it just now, duplicate comments allowed. Awesome.

    Moderator bcworkz

    (@bcworkz)

    The problem with old solutions is better options could arise even though the old solution works. That’s the case here. As of 4.4 there is a better option.

    Use the ‘duplicate_comment_id’ filter and return zero or false to allow duplicate comments. No need to mess with the die response 🙂

    Thread Starter TIEro

    (@tiero)

    Thanks – that’s exactly the information I was looking for.

    Just one note: if you know how to do something, it’d be really helpful to provide the example (in this case, a single line of code). The Codex is complete crap and for people who are relative newbies (like me), vague references to filters and returning values just means more research. It’s nice to have the final solution in one place for anyone searching in future, as well. 🙂

    Found on StackExchange: http://wordpress.stackexchange.com/questions/206418/how-to-allow-duplicate-comments-and-without-comment-text

    The line to add to allow duplicates (unconditionally) is, apparently:

    add_filter(‘duplicate_comment_id’, ‘__return_false’);

    Tested and works just dandy.

    Thanks again – nice to have the “proper” solution rather than a workaround!

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Removing the duplicate comment check’ is closed to new replies.