How to Add Custom Fields to Comments Form in WordPress

129

WordPress comes with a built-in comment system which allows you to have lively discussion around your content. By default, the comment area shows 4 fields (name, email, website address, and message). Recently one of our users asked us if they could add their own custom fields to WordPress comments form. The answer of course is yes. In this article, we will show you how to add custom fields to comments form in WordPress.

Video Tutorial

Subscribe to WPBeginner

If you don’t like the video or need more instructions, then continue reading.

First thing you need to do is install and activate the WordPress Comments Fields. Upon activation, the plugin will add a new menu item labeled ‘Comments Fields’ in your WordPress menu.

You need click on it to go to the plugins settings screen where you can add custom fields to the comment form.

Drag and drop input fields to the form

Currently, there are four types of custom fields you can add to your comment form (text input, select box, radio buttons, and checkboxes).

Simply drag a field and add it to the area labeled ‘Drag form fields here’. You will be able to see the options for each field as soon as you drop it in the editable area.

Configuring your custom comment form field

Each field usually has a title which will be displayed as the custom field label on your comment form. Data name is the name of the form field which needs to be all lower case and will be used to store the data.

Apart from that, you can also add a description text, an error message, and make a field required. Lastly you can also add a CSS class to each custom field, so that you can modify its appearance if needed (See our guide on how to style your WordPress comment form).

You can add as many custom fields as you want. Once you are done, simply click on the Save all changes button to store your settings.

The custom fields will appear just before the comment textarea. You can use the CSS class you added to adjust the appearance of the custom field.

Custom fields in WordPress comment form

The data entered by users in the custom fields will appear below their comments as comment meta.

Custom fields in the comment form will appear as comment meta

You will also be able to see the data entered into these fields on the comments page in your WordPress admin area.

Custom fields appearing as comment meta in the admin area

We hope this article helped you add custom fields to comments form in WordPress. You may also want to take a look at our tutorial on how to style WordPress comments layout.

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