I've searched hard but I've been nowhere near close to finding the answer to this...

I have a comment meta box that gives the commentor two tick boxes. The tick box is the only input into their comment, therefore there is lots of duplicate comments. At the same time there is no content in the comment.

So I need two things... firstly allow a comment with no text input needed, and secondly, allow duplicate comments.

  • Why don't you use post meta? A comment is an extremely complicated structure for a pair of check boxes?
    – s_ha_dum
    Commented Oct 24, 2015 at 15:51

1 Answer 1


WordPress will not allow you, using its default comment process, to insert empty comments into the database. This is enforced by wp_handle_comment_submission() with the following unconditional code:

if ( '' == $comment_content ) {
    return new WP_Error( 'require_valid_comment', __( '<strong>ERROR</strong>: please type a comment.' ), 200 );

If you insist on using comments, you will need to supply some non-empty value for $comment_content, which is most simply accomplished by inserting some whitespace content into the comment field itself.

As for duplicates, since WordPress 4.4.0 you can allow duplicate comments by using the duplicate_comment_id filter hook. As per the docs:

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.

For example, use the following code to unconditionally allow duplicate comments:

add_filter('duplicate_comment_id', '__return_false');

Hope this helps. :)

  • 1
    +1000 for add_filter('duplicate_comment_id', '__return_false');
    – tinyCoder
    Commented Mar 1, 2017 at 13:18
  • 1
    As of WordPress 5.1, you can now do add_filter('allow_empty_comment', '__return_true') to enable empty comments. If you want more complex logic, you can make your own callback function and grab submitted comment data out of the $_POST superglobal. Commented Jul 23, 2020 at 23:40

Not the answer you're looking for? Browse other questions tagged or ask your own question.