How to Quickly and Easily Customize the WordPress Comments Form

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:

{code type=php}

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:

{code type=php}
”,

);

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”.

{code type=php}
‘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.

Free Video Why 100 is NOT a Perfect Google PageSpeed Score (*5 Min Watch) Learn how to use Google PageSpeed Insights to set realistic goals, improve site speed, and why aiming for a perfect 100 is the WRONG goal.
Tags: