71 Responses

  1. Simon
    Simon Published |

    thanks guys, these first 3 posts are looking the right way. I’m looking forward to what will come from this nice collaboration!

    1. kamal
      kamal Published |


  2. Jean-Paul Horn
    Jean-Paul Horn Published |

    Excellent tutorial Justin! It’s on my backburner to do list for way too long now, so I should really do this ASAP! The tutorial will come in very handy. Thank you for an outstanding explanation.

  3. vinh
    vinh Published |

    I caught the title of this post on my iphone earlier and thought “could it be?” yea, it is and then some. holy crap, this post is sick. thank you so much.


  4. Jonathan Clarke
    Jonathan Clarke Published |

    Will threaded comments work with this implementation?

  5. Michael Beckwith
    Michael Beckwith Published |

    Very nice post that will definitely be bookmarked for future use. Just what I needed as I wanted to add html5 form fields to a base template but was unable to figure out how.

  6. Jayvie Canono
    Jayvie Canono Published |

    Justin: no more comments.php? I’m guessing the architecture is still there to support it but I guess we’re all supposed to be moving to comment_form because of plugin interoperability?

  7. rfmeier
    rfmeier Published |

    By far best explanation I’ve seen on this. Nice!

  8. MileHighTechGuy
    MileHighTechGuy Published |

    Great stuff!

    Plan on trying the News theme.

    Any chance of renaming it? I already have ‘News’ themes from Studio Press and WooThemes, which makes it hard to just dowload and install (I have to rename it 1st).


  9. Travis Watson
    Travis Watson Published |

    Thanks for this tutorial. I’ve just recently wrote a callback for wp_list_comments() and was looking for a good way to work on the comments form! Good to see comments getting some love recently from WordPress updates.

    I’m definitely liking DevPress so far! Keep up the great work guys!

  10. christine rondeau
    christine rondeau Published |

    Thanks for the tutorial. I just updated the theme which I use for all of my WordPress build and it only took me a few minutes to sort everything out.

  11. My Tweekly Updates for 2010-09-26 | visaap.nl
  12. Michael Beckwith
    Michael Beckwith Published |

    Any idea why the $commenter and $req stuff would make the fields disappear whether logged in or not?

  13. Ryan
    Ryan Published |

    So instead of a bunch of basic html to create the basic comment forms, we now have a bunch of crazy php with a bunch of html hidden and mixed up inside it, so it is confusing and impossible for anybody but programmers to make any basic adjustments to the comments area? Sweet. Awesome idea. That’s not complete backwards at all.

    1. Jack Davenport
      Jack Davenport Published |

      Just view your source code with the comment_form() function in, then find the div ‘respond’ and copy and paste it into your comments.php where the comment_form() function used to be.

      That’s how I did it to customise my form. This way you keep all the functionality but can easily take parts out and read the id’s and classes that need styling.

  14. Ryan
    Ryan Published |

    It is stopping people because not every web developer is a programmer also. Writing everything inside out like that prevents front end development, or at least turns it into a giant head ache just trying to do basic things.

  15. Shaun
    Shaun Published |

    Hi Justin, thanks for the tutorial. This is prob the most informative tut Ive come across on explaining how to use the filters and arguments available to the comment_form. Just a small question/request though – Im still very green to php and I can see what the arguments are doing to the outputed html, however each snippet you use for an example of what you can do to filter the output still leaves me a bit clueless since I kinda need to see one entire code block to get the bigger picture of how to apply each filter, hook, etc.

    Im basically not very clear on how to start and end the code. I understand now what filters to use, and thats awesome cuz thats exactly what Im looking to do, however now I dont really know where to put them?….Any help to really green developer would be super appreciated…and thank you for the great info once again.


  16. Pete
    Pete Published |

    Indeed, this is probably the best tutorial on the comment_form() function there is so far. Thanks for taking the time to write such an elaborate and helpful article, Justin. Keep up the good work!

  17. Dan Stramer
    Dan Stramer Published |

    After adding some more fields to the comment form, how do I output this data to the comment itself?


  18. Michael
    Michael Published |

    Hi Justin!

    Thanks for this explaination about comment_form(). There´s one thing i still do not understand: Can i split the output of comment_form() into two parts so that authorname, email and url surrounded by div 1 and commenttext and submit is surrounded by div 2? I need this to style these elements. Is there a way to do it with comment_form()?

    PS: Sorry about my english…

  19. Jorge Pedret
    Jorge Pedret Published |

    Thanks so much for putting this up! This documentation is not anywhere else!

  20. paul
    paul Published |

    testing 123

  21. jessor
    jessor Published |

    this extensive post was incredibly useful and saved me a ton of work since i didn’t know comment_form() existed yet. thanks!

  22. Cole
    Cole Published |

    I too agree with Dan Stramer, how do you output this data onto the contact form?

    1. Cole
      Cole Published |

      Agh! not contact form, comment list… 😛

  23. Anthony
    Anthony Published |

    You had mentioned this fields array..

    Where does this code actually go?

  24. Adding Content Under Your Post in a TwentyTen Child Theme - VoodooPress
  25. Whitney
    Whitney Published |

    Thanks for this! I’m trying to figure out how to customize my comments.php file without messing things up, and this is the first page I’ve found where it’s actually starting to make more sense.

  26. twilitegxa on "Customizing Comments Form?" | Upgrade Wordpress Now
  27. Richard Post
    Richard Post Published |

    Great! A wonderful tutorial on the comment_form() function.
    When I add a new to the form, what is the best way to capture the new data for insertion into the database?

  28. Richard Post
    Richard Post Published |

    Sorry, the last comment should have read “When I add a new input field to the form, what is the best way to capture the new data for insertion into the database?

  29. Milad
    Milad Published |

    Your post was very helpful and concise!
    Wish you all the best.

  30. james bond
    james bond Published |

    good post thanks

  31. skj
    skj Published |

    Thanks. This is the only documentation for I’ve found for comment_form() that actually helped me understand and navigate altering my theme. Big help.

  32. Coding & Styling Comments in Wordpress « Berrybellebee
  33. Custom Wordpress Comments | My Monkey Do
  34. Marc
    Marc Published |

    Thanks for this. If I add twitter for the comment form how would I go about retrieving the twitter username the commenter submits?

    1. Marc
      Marc Published |

      Nevermind… I found this: http://www.binarymoon.co.uk/2010/05/integrate-twitters-wordpress-comments/ And it answered my question. Thanks!

  35. Sam
    Sam Published |

    Thanks very much, this post was really helpful; parts of that api can be quite confusing.

  36. vale
    vale Published |

    Thanks for this tutorial, very useful and well made.
    I’d like to understand if the value of $required_text variable that the default comment_form uses can be retained as you did with $commenter = wp_get_current_commenter();
    $req = get_option( 'require_name_email' );

    or if we just have to set it.

  37. Renji
    Renji Published |

    Thanks so much for this awesome detailed post. Helped a lot.

  38. mauricio
    mauricio Published |

    Thanks so much for the great tutorial. Everything is very clear, but there’s something about WP forms that I still cannot figure out and wonder if you know how:
    When a user misses a mandatory form field, or enters the wrong type of info, is there a way to create custom error messages displaying in the form page itself? Currently WP sends me to a default error page. I want to avoid this.
    Thanks in advance!

  39. Cleaning up the Comment Form | Hi, I'm Nick Hamze
  40. katie black
    katie black Published |

    There are so many blogs about wordpress. That is how popular it has become since its inception. This blog post is a great addition to its portfolio. It is important for wordpress users to know how to use the comment form. With this blog post, hopefully, more wordpress users are enlightened.

  41. Reshma
    Reshma Published |


    I have been trying to customize my comment_form and the one thing I can’t figure out is how to change the order of fields.

    For instance, I’d like the Comment area first, followed by the author name and url. The default has the name, url and then comment area.

    Your helps is greatly appreciated!!


  42. Top 13 WordPress Comments design Tutorials | pixeldesignpress.com
  43. Top 13 WordPress Comments design Tutorials | pixeldesignpress.com
  44. Roger
    Roger Published |

    This is just what i have been looking for, great article!
    I am just starting in WP, but have done web dev in the other technologies for a while. I’ve been piecing together a CMS type theme from different tidbits that I’ve found from all over. I’m now to the point that I need to add some of the “blog” stuff to a couple of pages and was looking for a way to add comments to a page.
    This will be a great starting place.
    Just wanted to say that it seems that when I am searching the web for ideas that your name is always at the top of the list! You do awesome work!!

    Thanks, Roger K

  45. Arlene Creevy
    Arlene Creevy Published |

    Your tutorial was great. However, I am a photographer that is using wordpress theme Twenty Ten and I’m sorry to disappoint all you bloggers, but I simply want to display my photography and not blog. Therefore, I’d like to remove the Leave a Reply & Comment form on the bottom of my pages. The comments have been a ROYAL nuissance as I get tons of spam. I have searched word press forums for hours trying to find a solution. My theory is after I finish my web site, I can opt to put the comments, reply fields back in, but for now I would like them out. Can you help me. I have printed out 4 pages of how to remove these items, one of which did work, but then I have this very nice error message on the bottom of my pages. Thanks for any help or input you can give me.

  46. Ed
    Ed Published |


    How can I edit HTML in regardings to the tag positions. I understand all functions ect but don’t know what is the best way to implement some structure. I’d like to replace fields and main comments textarea (fields below). I’d also like to move cancel next to submit. I’ve done it using CSS (positions) but I suppose this is not the best way. I suppose should be some way to add filters _before, _after but doesn’t look clear from documentation to me.

  47. vajrasar
    vajrasar Published |

    How can I fire onclick event when a user clicks on Submit Comment?

    How can I add that functionality?


  48. Michael
    Michael Published |

    Hi Justin,

    I know it’s an old article, but I hope you’re still around and leave me a useful answer.

    I have tried since last Friday (7 days) to figure out this problem, and though ( I thought) I understand your above article, no matter how hard I try, it will not compute for me 🙁

    What I try to accomplish for so easy before the no-longer-that-new comment form. I simply want the input field to be at the left, followed by the asterix and then the label.

    Do you have an solution?

    Any help will be greatly appreciated, thank you.


  49. WordPress comment form » Sasha's portfolio
  50. Mattia
    Mattia Published |

    Hi, how can I show the comments if I use comment_form()? If I use comments_template() it shows the form and the comments of the post, but if I use comment_form only and then comment a post, the comments aren’t showing up! Only the form…. ;((( thanks a lot

  51. comments | Aquabook Theme
    comments | Aquabook Theme at |
  52. Koinuta
    Koinuta Published |

    This is nice..

  53. John
    John Published |

    Justin Tadlock, I think I love you. Google leads me to your site often, and I always find quality info. Thank you!

  54. How to And Where to Customize Comment_form() in WordPress
  55. Pedro Simão
    Pedro Simão Published |


    I am trying to insert many comment forms in the main page, each comment form should comment only on the post and page that it referes to. But it keep on sending the comment to the main page.

    I have tried this:

    And also this:

    But it keeps on sending comments to the main page.

    What should I do?


  56. Iftekhar
    Iftekhar Published |

    Just wanted to say “Thank You”. Lately I was replacing the default comment system in WP with the Facebook Comment system but I am going back. You made my day 🙂

  57. RIck H
    RIck H Published |

    Good tutorial. Used it to develop my own customized contact form plugin, where I re-define the $args for the comment form fields.

    But it turns out, while testing, that some themes create their own ‘textarea’ field, which adds to my ‘textarea’ field, resulting in two comment text fields. Not good.

    I have set my add_filter( ‘comment_form_default_fields’, my_function(), 99,1) with a higher priority (99) so that it happens later in the ‘page build’ (after the theme does it’s comment_form_default_fields), but the duplicates comment text boxes are still there. Also tried a priority of 8, and that didn’t do it either.

    I also tried unset($arg) (the parameter passed to my_function; contains the array of fields/etc), and a unset($_GLOBAL[$arg]), and still the duplicate textarea field shows up.

    So, can you think of a generic (works for any theme) that can determine if the comment field has already been defined? And, if the duplicate is found, remove the one in the theme, so I can replace it with mine? Or is there a better way to ‘start over’ on the defining of fields in the comment form.

    I understand that the problem might be caused by bad coding practices on the theme, but would like to find a workaround so a theme doesn’t change the fields I want on the comment form.


  58. nanija
    nanija Published |

    this is awesome blogs, really helpful for the comments section editing. thanks for sharing

Comments are closed.