Resources     Blog  

  1. Home
  2. WordPress Tutorials
  3. How To Customize a WordPress Comment Form

How To Customize a WordPress Comment Form

The comment form in WordPress can be utilized for some very important things. Not only does a WordPress comment form encourage your website users to participate in a discussion, but it is also an important tool for overall user engagement.

This is why it is important to customize a WordPress comment form to insure you get the most use out of it.

Now, there are a couple of ways that you can go about customizing the layout of your comments. Today I am going to look at both ways to do this, so you will have a choice.

For the easier way we will look at a plugin that will allow you to design the form several different ways. This should help boost user engagement on your website.

Toward the end of this tutorial, I will also give you a few pieces of code that will allow you to make some other customizations should you choose to go more advanced with it.

Customize WordPress Comment Form Using a Plugin

First off, let’s take a look at how we can perform WordPress form customizations using a plugin. For this, I have found a great little plugin called Advanced Comment Form.

This plugin is flexible and easy to use. It allows you to customize a WordPress form right from the backend of your website, without having to worry about placing code anywhere.

Among other things, you will be able to:

  • Remove Form Fields
  • Change Form Fields
  • Change Text
  • Switch Layout Styles
  • Use Shortcode

Install and Activate the Plugin

The first thing you want to do is install and activate the Advanced Comment Form plugin on your website.

Install and activate advanced comment form plugin

Once the plugin has been installed and activated within the WordPress admin area of your website, click on Comments > Comment Form. This will take you to the main setup page of the plugin.

Here is where we will customize a WordPress comment form.

Click on comments then click on comment form

On the main setting’s page of the Advanced Comment Form Plugin, you can start to make the changes you want and start your customization.

The first section is titled “Fields.” In the “Fields” section, you can remove URL fields and also remove email fields if you so choose.

You can see each selection is very detailed and tells you exactly what will happen if you click on the relevant checkboxes.

Customize comment and email fields here

The second section you will see is titled “Texts.” In this section you will be able to add or remove text from your WordPress comment form. The text fields include “texts before the form” and texts after the form.”

Don’t be afraid to use the custom HTML tags and attributes the plugin suggests. This will only serve to spice up the form and give you even more customization options.

comment form text fields here

The third and final section you see is titled “Layouts.” This section is pretty straightforward. Clicking on the checkbox will give you a two-column form layout style. It is all about personal preference.

form layout styles here

Now that you have made all the changes and customizations you want don’t forget to click on the “Save” button to make sure your WordPress comment form customizations take hold.

Customize WordPress Comment Form Using Code

This is for the more advanced user. If you don’t want to use the plugin above to customize the comment form, then you can use some of the following blocks of code to perform customization.

I am not going to get overly advanced in this, but I am going to show you how to perform the above plugin functions using some code. The code you place will be based on the customization you want to make.

Here are some popular ones.

Add Some Policy Text to a WordPress Comment Form

Sometimes things can get heated in a comment debate, or even out of hand altogether. Adding some comment form policy text can be a good idea for just this reason.

Add the following code to your theme’s functions.php file:

function yoursitename_comment_text_before($arg) {

$arg[‘comment_notes_before’] = “<p class=’comment-policy’>We are glad you have chosen to leave a comment. Please keep in mind that comments are moderated according to our <a href=’http://www.yoursitename.com/comment-policy-page/’>comment policy</a>.</p>”;

return $arg;
}

add_filter(‘comment_form_defaults’, ‘yoursitename_comment_text_before’);

Move Comment Form Text Field to the Bottom

As you might have noticed, a WordPress comment form displays the comment text area before anything else. In some cases you might want to change this and put the field first, followed by name, email, etc.

To accomplish this add the following code to your theme’s functions.php file:

function examplename_move_comment_field_to_bottom( $fields ) {
$comment_field = $fields[‘comment’];
unset( $fields[‘comment’] );
$fields[‘comment’] = $comment_field;
return $fields;
}

add_filter( ‘comment_form_fields’, ‘examplename_move_comment_field_to_bottom’

Delete Website URL Field From WordPress Comment Form

Spam has been a long-time issue on WordPress comment forms. There are a lot of different ways to deal with Spam. Deleting the website URL from a comment will not stop spam, it will at least help with the issue of a bad author website link.

You can customize the form by deleting the URL field by placing the following code in your theme’s functions.php file:

function yoursitename_remove_comment_url($arg) {
$arg[‘url’] = ”;
return $arg;
}

add_filter(‘comment_form_default_fields’, ‘yoursitename_remove_comment_url’);

Add a Checkbox to Allow Users to Subscribe to Comments

Trying to follow a comment thread can be difficult. This is especially true when replies are placed in different areas of the comment list. You can quickly and easily allow website users to subscribe to comments by placing a “subscribe to comments’ checkbox on the form.

To achieve this, install and activate the “Subscribe to Comments Reloaded” plugin. This is a fun plugin that easily allows commenters to sign up for e-mail notification of subsequent comment entries.

Once you have installed and activated the plugin go to Settings > Subscribe to Comments, and setup the plugin how you see fit. If you would like a more detailed example of how to set this plugin up, you can checkout how to add visitor notifications for comment replies.

It isn’t difficult to customize a WordPress comment form. As stated above, you can get the customization done a couple of different ways.

I hope this article showed you how easy it is to perform WordPress form customization by using a plugin or using code.

Do you prefer the plugin technique for WordPress form customization to the code technique? Have you found that when you customize a WordPress comment form you get more user interaction?

Author: Jeremy Holcombe

Growing up in Hawaii, Jeremy started his freelance writing career doing resumes, business plans, article writing, and everything in between. He now specializes in online marketing and content writing and is part of the Content Marketing Team at GreenGeeks.

Was this article helpful?

Related Articles

Leave a Comment

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