MB Comment Meta is an extension for Meta Box plugin, which adds custom fields to comments in WordPress. The plugin supports all field types from Meta Box: text, select, color, media, date time, etc. and all the field options.

mb comment meta

It's worth noting that the meta data (custom fields) in WordPress is available not only for posts, but also for other object types such as taxonomy terms, users and comments. However, these object types don't have user interface to enter custom fields. WordPress developers have to add manual code to make it work. And that takes quite a lot of time and effort, especially for complex fields such as file upload or date picker.

With the help of Meta Box plugin and MB Comment Meta extension, you're able to complete this task in a short amount of time. Meta Box provides a solid foundation for all the custom fields work, from building the user interface to handling the data. And MB Comment Meta extension connects the custom fields with comments in WordPress. So, you don't need to think about how to display fields and how to save the data. All you need to do is just declare which field types you want to add to comments and let MB Comment Meta handle the rest.

MB Comment Meta works like a bridge between Meta Box and WordPress comments. Thus, it supports all the Meta Box features such as cloning fields or custom attributes. All you need to do is one simple line of code.

Installation

You need to install Meta Box plugin first

  • Go to Plugins → Add New and search for Meta Box
  • Click Install Now button to install the plugin
  • After installing, click Activate Plugin to activate the plugin

Install MB Comment Meta extension:

  • Go to Plugins | Add New and search for MB Comment Meta
  • Click Install Now button to install the plugin
  • After installing, click Activate Plugin to activate the plugin

Usage

Before adding custom fields to comments, it's important to know how to create a meta box with Meta Box plugin first. The meta box and custom fields are creating by declaring an array of settings in PHP. By default, they're custom fields for posts.

To make them custom fields for comments, simply add the following line to the meta box settings code in PHP:

'type' => 'comment',

And then, go to edit a comment in the WordPress admin area. The fields will appear as the above screenshot.

It's important to note that MB Comment Meta works only in the back end. It does not add custom fields for comments in the front end.

Finally, to get values of comment fields and display them in the front end, please see this documentation. It uses the same helper function rwmb_meta to get the field value and display it.

Contribute to MB Comment Meta

MB Comment Meta is an open-source plugin and hosted on Github. If you have any idea, suggestion or any problem, please open an issue or create a pull request to help us improving it.

Download the plugin from WordPress.org | Contribute to the plugin on Github