WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've got a great Comment Form and Threaded Comments setup by using the native WordPress functions: comment_form and wp_list_comments.

However, I'm trying to also create a custom Contest Comment template for certain posts. I call comments_template('/contest-comments.php', true); conditionally based on whether a certain custom field exists or not. It works great.

I'm trying to make it look along the lines of http://2010.sf.wordcamp.org/attendees/

I only want to show the person's name wrapped in a link and their avatar. Therefore, I want my comment form to only show the Name, Email, and URL fields. The text area should be hidden.

For the Comment Form, I am passing an empty value for the comment_field key in the $args array I'm passing into comment_form.

This makes the comment form look okay, but when someone submits a comment, they get a warning from WordPress saying that their message was blank.

Any solutions on how to solve this? Thanks!

share|improve this question
up vote 7 down vote accepted

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:

share|improve this answer
I intend to use this on a universal single.php file with a custom comment template. I'm a bit confused as to why I would need a custom page template. – Sahas Katta Dec 21 '10 at 18:27
you don't, if you want that textarea disabled trough the entire site. – onetrickpony Dec 21 '10 at 18:50
I got it working, I just found another trick to solve the issue. I turned what would be normally the text area into a hidden field with a value that includes the time, article title, and post ID. That avoid the duplicate warning issue. – Sahas Katta Dec 22 '10 at 6:27

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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