Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
WPB Cup
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

How to Add Custom Fields to Comments Form in WordPress

Editorial Note: We earn a commission from partner links on WPBeginner. Commissions do not affect our editors' opinions or evaluations. Learn more about Editorial Process.

Do you want to add custom fields to the WordPress comment form?

The default WordPress comment form has four fields (name, email, website, and message). But sometimes you may want to add other fields like rating, checkbox option, etc.

In this article, we will show you how to customize the comment form in WordPress by adding custom fields.

How to add custom fields to comments Form in WordPress

Why Add Custom Fields to Comments Form in WordPress?

By default, the WordPress comment form asks for the visitor’s name, email address, and website. It also has an area where people can type in their comment, and a checkbox that visitors can use to save their personal information for the next time they post a comment.

The standard WordPress comment form

For most WordPress websites, this is perfect. However, sometimes you might want to customize the WordPress comment form to collect more information from your visitors.

This can help you learn more about the people who visit your WordPress blog, so you can provide them with a better experience.

Custom fields can also make your comment sections more engaging and lively. For example, you might ask visitors for information that will spark discussion and debate in your site’s comment section.

Or if you’re using comments for reviews, then you might want users to add the rating score in comments.

That being said, let’s see how you can add custom fields to the standard comments form on your WordPress website.

How to Customize the WordPress Comment Form

The easiest way to add custom fields to the WordPress comment form is by using the WordPress Comments Fields plugin.

This plugin lets you add a range of different fields to your comment forms, including checkboxes, radio buttons, and dropdown menus.

An example of a comment form with custom fields

All of the information that visitors enter into the custom fields will appear as part of their published comment.

This is why it’s a good idea to avoid using custom comment fields to collect sensitive information from your visitors.

A published comment featuring custom fields

First, you’ll need to install and activate the WordPress Comments Fields plugin. For more details, please see our guide on how to install a WordPress plugin.

Upon activation, go to Comments » Comment Fields. To add a custom field to your comment form, simply click on the ‘Add field’ button.

Adding a custom field to the WordPress comment form

You can now choose the type of field that you want to add to your custom WordPress comment form.

Your choices include text fields, checkboxes, and radio buttons.

Adding different custom fields to the WordPress comment form

Once you’ve done that, you’ll see additional settings where you can configure the custom field.

To start, you’ll need to create a label. This will appear above your custom comment field and let visitors know what information you expect them to enter.

You can type your label into the ‘Title’ field. As you type, the plugin will fill in the ‘Data name’ field automatically.

The data name will help you identify this information when it’s used in other locations, for example in any email notifications you’ve set up.

If you want to use a different value instead, then you can simply change the text in the ‘Data name’ field.

Adding a title to your custom comment form

After you’ve done that, you can type an optional description into the ‘Description’ field.

This will be shown next to the field’s title. With that in mind, you can use the description to provide some extra information about the custom field, such as why you need this information from the visitor.

Adding a description to your custom comment form field

You can also set a minimum and maximum limit for how many characters the visitor can type into the custom field.

In this way, you can encourage visitors to enter the right information, while helping to combat comment spam in WordPress. For example, if you’re creating a custom field where visitors can type in their phone number, then it makes sense to set a maximum and minimum limit.

To set these optional limits, type your values into the ‘Max Length’ and ‘Min Length’ boxes.

Adding limits to your WordPress custom comment form

By default, everyone who visits your site will see this extra field in your WordPress custom comment form.

However, sometimes you may only want to show the custom field to people who have a certain user role. For example, if you’ve created a WordPress membership site, then you might want to show your custom field to registered members only.

To limit this field to members or guests, simply open the ‘Visibility’ dropdown and then click on either ‘Only members’ or ‘Only Guests.’

Creating a members-only custom comment field

Another option is to only show the custom field to people who have a specific user role.

To do this, open the ‘Visibility’ dropdown and then click on ‘By role.’ This adds a new field where you can type in the user role. To add multiple user roles, simply separate each role with a comma.

Changing who can see your custom comment field

Before the visitor starts typing into the custom field, you may want to show a placeholder value. This can help people understand what information they need to type into the custom comment field.

You can type your placeholder value into the ‘Placeholder’ field.

Adding a placeholder value to your WordPress comment field

If the visitor doesn’t enter anything into the custom field, then you may want to use a default value instead. For example, you might create a checkbox that’s set to ‘opt-out’ by default.

You can type a default value into the ‘Set default value’ field.

Changing who can see your custom comment field

Your custom comment field is marked as optional by default. However, you can make the field mandatory so that visitors can’t submit a comment without completing this field.

To make this change to your custom WordPress comment form, simply go ahead and check the ‘Required’ box.

Marking the field as required

Some custom fields have extra settings that you can configure.

If you’re creating a ‘Select Input,’ ‘Radio Input,’ or ‘Checkbox Input’ field, then make sure you click on the ‘Add Options’ tab.

Here, you can create all the options that visitors can choose between. For example, you might create ‘Yes’ and ‘No’ options for a custom checkbox field.

Creating a multi-choice option

To create an option, simply type in the text that will be shown to the visitor.

To add another option, go ahead and click on the + button and then type in the text that you want to use.

You can add as many options as you want to your WordPress custom comment form following the same process described above.

Creating a multiple choice comment field

When you’re happy with the options you’ve created, just click on the ‘Add Field’ button.

The popup will now close and you’ll see your new custom field in the Comments » Comment Fields section of the WordPress dashboard.

You can now add more fields to your custom WordPress comment form by following the same process described above.

When you’re ready to add a custom field to the comment form, make sure its ‘Status’ slider is set to ‘On.’

You can then go ahead and click on the ‘Save Fields’ button.

Adding the custom field to your WordPress website

Now if you visit your site, you’ll see the extra fields in the custom WordPress comment form.

If you want to remove a custom field from the comment form at any point, then simply head back to Comments » Comment Fields.

You can then find the custom field that you want to remove, and click on its sider so it shows a red ‘Off’ label.

Once you’ve done that, just click on the Save Fields button.

Removing a field from your custom comment form

Now if you check your website, you’ll see that this custom field has disappeared from the WordPress comment form.

We hope this article helped you learn how to add custom fields to the comments form in WordPress. You can also go through our guide on the best membership plugins and how to create a contact form in WordPress.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. See how WPBeginner is funded, why it matters, and how you can support us. Here's our editorial process.

Editorial Staff

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

The Ultimate WordPress Toolkit

Get FREE access to our toolkit - a collection of WordPress related products and resources that every professional should have!

Reader Interactions

13 CommentsLeave a Reply

  1. Syed Balkhi says

    Hey WPBeginner readers,
    Did you know you can win exciting prizes by commenting on WPBeginner?
    Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
    You can get more details about the contest from here.
    Start sharing your thoughts below to stand a chance to win!

    • WPBeginner Support says

      For any custom comment plugin we would recommend checking with the plugin’s support as normally those plugins have their own way to include a custom field :)

      Admin

  2. Minimo says

    This plugin hasn’t been update in 2 years. Is there any trustworthy aka. actively maintained solution? Cheers!

    • WPBeginner Support says

      While we don’t have a specific plugin we would recommend at the moment, you could take a look at advanced custom fields for another possible method. We will be sure to look for other plugin options

      Admin

  3. Peter says

    Thanks for this great post.

    I want to add a conditional php code in the comments template source file. The idea is to check the value of a custom field chosen by a user and then to display some text depending on it ((For example, ” if (CUSTOM_Field = ‘A’) { echo ‘…”; } else { echo ‘…’; }). How can I retrieve the custom field?

  4. Olawale Daniel says

    Helpful tutorial…I love this plugin. But is there a way to manually code this without installing this plugin?

    Thanks for your support.

  5. R. F. says

    Nice tutorial! Everything works fine, but now I am looking for an option to ONLY display the extra content of the comment form on a specific page, NOT on all pages.

    Does anyboday have an idea of how this can be arranged?

    Thanks!

    • Dmitry says

      hi,
      Maybe my solution is not universal but I had to realize the same feature on my web site.
      I just added a custom field to the whole comment form for all the pages and hide this field in my css. Then showed it for a body page class.
      E.g:
      .custom_field_name{display: none}
      body.customer-feedback .custom_field_name{display: block}
      If your field must be required, just make it NOT required in the plugin admin area and do a custom field check with javascript in your page.php theme file,
      E.g:
      <? echo(is_page('customer-feedback')) ? 'if(document.querySelector(‘.custom_field_name’).value == ”) alert(‘Please fill Custom Field’);’ : ” ?>

  6. FlickChicks says

    Thanks for this post! I am wondering if this plugin will allow you to change the phrase “Leave a Reply” to something else like “Share Your Thoughts.” I have looked around and not seen an easy fix/plugin for this. I’ve noticed that in wordpress.com sites you can change it under “Settings” but not in .orgs. Any info would be appreciated. I’m using a child theme and could add code easily in a function.php file, but other than that I’m still pretty new to all this. Thanks!

  7. Joie says

    I actually have a question about something other than this regarding comments. I wrote a post on my (twenty twelve theme) blog yesterday and then shared it on my facebook (personal) page. It showed up on FB with the title of the blog -a straight vertical line- then the title of my website. In the middle of the first sentence was the “Leave a reply.” It really looked messed up. I looked all over the coding so I could cut and paste it at the bottom. It wasn’t there. I suspect it is in the Editor (under Appearnces) coding. But I am afraid to mess with that. Can you please (!) help me with this?

Leave a Reply to WPBeginner Support Cancel reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WPBeginner Assistant
How can I help you?

By chatting, you consent to this chat being stored according to our privacy policy and your email will be added to receive weekly WordPress tutorials from WPBeginner.