How To Easily Customize WordPress Comment Form


WordPress is one of the famous platforms that can be customized up to a great extent. It consists of a huge repository of plugins to provide various functionality to your website.

Apart from its advantage, these plugins may also have negative impact on your website like-

  • Some heavy WordPress plugins slow down your site
  • Some plugins are not secure to use
  • Some free plugins may not be available forever
  • If your website has more than one plugin, then it may suffer from plugins compatibility issue
  • Free plugins may contain encrypted code that may harm your website

So it’s better to avoid the use of such plugins whenever possible and choose coding option instead.

You might also be interested in:

In this tutorial I will explain to you how you can customize WordPress default comments yourself without using any external plugin:

Let’s Understand WordPress Comment System:

The most basic function which is responsible for displaying comment box is comment_form().

You will see a call to this function in a bottom section of “comments.php” file.

Usually single.PHP, page.PHP, contact form template of theme call comment_form() function to display comment box. Below is the snapshot of twenty twelve theme’s “comments.php”.

Function commens_form() takes two parameters:

<?php comment_form( $args, $post_id ); ?>

 More Details about this function.

But the default use is just

<?php comment_form(); ?>

When you call this function without any argument then comment box (twenty twelve themes) looks like this:

Parameters are just optional. In its default call, it displays fields like a name (required), email (required), website, and comment.

Let’s see how you can pass parameters and change your default comment form. In first parameter ‘$args’ (an array) you can pass various important arguments such as fields, title_reply, label_submit etc. These arguments will help you change your default comment form.

  • fields   – Lets you display fields of your choice in a comment form.
  • title_reply – This argument changes title of reply, by default you will see “Leave a reply”.
  • label_submit – It changes text written on Submit button.
  • comment_field – It is responsible for text area and label of comment body.

Just for a small example let’s consider I want to change default comment box title which is “Leave a reply” in our case. Then I will pass my new title as an argument to comments_form(); function:

<?php comment_form(array('title_reply'=>'Got Something To Say:')); ?>

Now comment box title will be “Got Something To Say”.

Remove fields from WordPress Comment Box:

Now, what if you have to add/remove fields from default contact form to change the feel of your comment box? I am eliminating website field from default comment box by playing with ‘fields’ argument:

<?php $comment_args = array( ‘title_reply’=>’Got Something To Say:’,

‘fields’ => apply_filters( ‘comment_form_default_fields’, array(

‘author’ => ‘<p class=”comment-form-author”>’ . ‘<label for=”author”>’ . __( ‘Your Good Name’ ) . ‘</label> ‘ . ( $req ? ‘<span>*</span>’ : ” ) .

‘<input id=”author” name=”author” type=”text” value=”‘ . esc_attr( $commenter[‘comment_author’] ) . ‘” size=”30″‘ . $aria_req . ‘ /></p>’,

’email’ => ‘<p class=”comment-form-email”>’ .

‘<label for=”email”>’ . __( ‘Your Email Please’ ) . ‘</label> ‘ .

( $req ? ‘<span>*</span>’ : ” ) .

‘<input id=”email” name=”email” type=”text” value=”‘ . esc_attr( $commenter[‘comment_author_email’] ) . ‘” size=”30″‘ . $aria_req . ‘ />’.'</p>’,

‘url’ => ” ) ),

‘comment_field’ => ‘<p>’ .

‘<label for=”comment”>’ . __( ‘Let us know what you have to say:’ ) . ‘</label>’ .

‘<textarea id=”comment” name=”comment” cols=”45″ rows=”8″ aria-required=”true”></textarea>’ .


‘comment_notes_after’ => ”,


comment_form($comment_args); ?>

Finally, our contact form of twenty twelve theme looks like this:


This tutorial covered basics of customizing comment box, a lot more can be done in order to change the appearance of the comment form as well. WordPress provides us hooks and filters to add remove fields and customize our form up to a great extent. Comments are very important for any blog to interact with their audience so I recommend every blogger and website owner to change their WordPress default comment system and make it more creative and pleasing.

You might be interested in:

Read More Articles

21 Replies to “How To Easily Customize WordPress Comment Form”

  1. Thanks for that! And how can I put the labels of the fields inside the field, just like the comment form you are using? That would be awsome :-)

  2. Thanks for valuable info. I’ve been look for this all day and spent my day off just to look for this. I’m actually new to this coding.
    Also If u can show me how to change the button text “Post comment”, I would save plenty of time and be one of your big fans. :)

  3. Great tutorial, just what I was looking for!
    Only thing, I don’t understand why in my form the textarea for the comment appears before the inputs for name and email. The code is just the same as yours.
    Thank you in advance!

  4. I’m currently editing my comment form, thanks for the tutorial. However, I still have a questions, let’s say for some posts, I really disable the comment and pingback/trackback while for some posts I allow the comments.

    Can I load the css of comment form and comment box conditionally? I mean, if there is a comment even 1 and new comment is allowed, then load the comment box css and comment form css.

    If there is comment displayed but the comment form are closed then just load commment box css, not comment form css.

    I there are no both of them then do not load both css (comment box css and comment form css).

    Is it possible? I just want to minimize the css file so my site can load faster.

    Thanks for the help

  5. Hi–

    This was very helpful. I would also like to reduce the space between Comments I receive. It uses up a lot of real estate. But I notice so does this page. Is that a function of WordPress, then, that cannot be changed?

    Many thanks for any suggestions.

  6. good information on comment form.
    But i need to change comment theme.
    And How to change default comment system of WordPress?
    I am developing my own custom comment theme.
    I want to add Div to each comment but don’t know where to add

  7. Hi, thanks for this article. I started to overwrite the comment_form function, but your way is really simpler as that.
    best regards!

  8. This? is awesome! Thank you very much; this is *exactly* the question I was struggling with on a site a manage. Much appreciated.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.