How to Quickly and Easily Customize the WordPress Comments Form

Many WordPress themes utilize the standard WordPress comments form. Introduced in WordPress 3.0, it’s meant to be a simple tag to output a complete commenting form within a theme template. Making minor changes to the form might seem baffling at first, but it’s really not too difficult.

Step 1: Don’t hack the core.

Here’s the most important tip: Don’t edit the /wp-includes/comment-template.php file. Someone may have suggested it to you in the forums as the quickest way to customize the comments template, but it’s never really a good idea to edit the WordPress core files. There’s a better way.

Step 2: Edit the Comment Form Tag.

Open the file containing the comment form tag. Here’s what it looks like:

1
<?php comment_form() ?>

More than likely the theme file that you’re looking for is going to be comments.php.

There are some some different parameters you can pass to the function for modifying the form. The codex has several handy examples for editing the comments template. Let’s do a simple one.

If you want to remove the HTML text that follows the form (“You may use these HTML tags and attributes…”), here’s how to modify the tag:

1
2
3
4
5
6
7
8
9
10
<?php 
$comments_args = array(

        // remove "Text or HTML to be displayed after the set of comment fields"
        'comment_notes_after' => '',

);

comment_form($comments_args);
?>

Not so difficult, right? Now, let’s change the title of the comment form. By default it says “Leave a Reply”. Let’s change that to “Comment”.

1
2
3
4
5
6
7
8
9
<?php 
$comments_args = array(

        // change "Leave a Reply" to "Comment"
       'title_reply'=>'Comment', 
);

comment_form($comments_args);
?>

You can change the text to be something more creative than “Comment”, such as “Discuss this post” or “Have something to say?”

The codex includes several more examples, but these simple ones should be enough to get you started. You can also rest assured that these quick edits to your theme’s comments file will be safe, even when you upgrade the WordPress core.

Featured Plugin - WordPress Appointments Plugin

Take, set and manage appointments and client bookings without having to leave WordPress. Appointments+ makes it easy.
Find out more

Featured Plugin - WordPress Infinite SEO Plugin

Fully integrated with the SEOMoz API, complete with automatic links, sitemaps and SEO optimization of your WordPress setup - this is the only plugin you need to help you rank your site number 1 on Google - nothing else compares.
Find out more

Featured Plugin - WordPress Ecommerce Shopping Cart Plugin

Out of all the WordPress ecommerce plugins available, MarketPress has got to be the winner - easy to configure, powerful functionality, multiple gateways and more. A simply brilliant plugin!
Find out more

Featured Plugin - WordPress Membership Site Plugin

If you're thinking about starting a paid, or just private, membership site then this is truly the plugin you've been looking for. Easy to use, massively configurable and ready to go out of the box!
Find out more

Featured Plugin - WordPress Google Maps Plugin

Simply insert google maps into posts, sidebars and pages - show directions, streetview, provide image overlays and do it all from a simple button and comprehensive widget.
Find out more

Featured Plugin - WordPress Wiki Plugin

To get a wiki up and running you used to need to install Mediawiki and toil away for days configuring it... not any more! This plugin gives you *all* the functionality you want from a wiki, in WordPress!!!
Find out more

Featured Plugin - WordPress Q&A Site Plugin

It's now incredibly easy to start your own Q&A site using nothing more than WordPress - The Q&A plugin simply and brilliantly transforms any site, or page, into a perfect support or Q&A environment.
Find out more

Featured Plugin - WordPress Facebook Plugin

Would you like to add Facebook comments, registration, 'Like' buttons and autoposting to your WP site? Well, The Ultimate Facebook plugin has got that all covered!
Find out more

Featured Plugin - WordPress Pop-Up Chat Plugin

No javascript required, no third part chat engine, just fully featured chat right in your own database on your own WP sites - couldn't be easier.
Find out more

Comments (2)

    • If you want to do it the right way, without using CSS hacks, use the following code:

      //Remove URL from comments
      add_filter('comment_form_default_fields', 'url_filtered');
      function url_filtered($fields)
      {
      if(isset($fields['url']))
      unset($fields['url']);
      return $fields;
      }

      Also make sure that you remove the HTML code for the input textbox for URL from comments.php. If you are not using one, then make a copy of WP original comments.php file & delete the code from it. Then call it using comment_form() function in loop-single.php file or wherever else you want to.

      Hope that helps.

Participate