Does WordPress Allow Blank/Empty Comment Submissions In WordPress?

Short answer: It doesn’t, but you can get around this:

add_filter('comment_form_field_comment', 'my_comment_form_field_comment');
function my_comment_form_field_comment($default){
  return false;
}

add_action('pre_comment_on_post', 'my_pre_comment_on_post');
function my_pre_comment_on_post($post_id){
  $some_random_value = rand(0, 384534);
  $_POST['comment'] = "Default comment. Some random value to avoid duplicate comment warning: {$some_random_value}";
}

If you want this only for certain pages, then you should create a custom page template, for eg “boo.php”, and in the code I posted above, only add these filters if the current page template is boo (use $post->page_template to get the current page template when doing the check).

Related questions:

Leave a Comment