Title: Retrieving custom fields
Last modified: August 30, 2016

---

# Retrieving custom fields

 *  [metallikat79](https://wordpress.org/support/users/metallikat79/)
 * (@metallikat79)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/retrieving-custom-fields/)
 * Hello,
 * Thank you for a great plug-in, very versatile . However, I have a couple of custom
   fields in my comment form, for example, ‘country’. How can I get what was entered
   into this field to display along with my comment?
 * The meta for this field is being saved using the following code in my functions.
   php:
 *     ```
       if ( ( isset( $_POST['country'] ) ) && ( $_POST['country'] != '') )
           $country = wp_filter_nohtml_kses($_POST['country']);
           add_comment_meta( $comment_id, 'country', $country );
       ```
   
 * And i am able to retrieve the fields when I use the standard wp list comments
   with a callback:
    `<?php wp_list_comments( 'type=comment&callback=tafcomments');?
   >` which calls back to this function in my functions.php:
 *     ```
       function tafcomments($comment, $args, $depth) {
               $country = get_comment_meta( $comment->comment_ID, 'country', true );
               $GLOBALS['comment'] = $comment;
               extract($args, EXTR_SKIP);
               ?>
               <div class="commentBox">
                   <?php comment_text(); ?>
                   <h6><?php echo $country; ?></h6>
               </div>
               <?php
           };
       ```
   
 * But how do i achieve the same result using this plug-in??
 * [https://wordpress.org/plugins/bwp-recent-comments/](https://wordpress.org/plugins/bwp-recent-comments/)

The topic ‘Retrieving custom fields’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/bwp-recent-comments.svg)
 * [Better WordPress Recent Comments](https://wordpress.org/plugins/bwp-recent-comments/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/bwp-recent-comments/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/bwp-recent-comments/)
 * [Active Topics](https://wordpress.org/support/plugin/bwp-recent-comments/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/bwp-recent-comments/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/bwp-recent-comments/reviews/)

## Tags

 * [custom fields](https://wordpress.org/support/topic-tag/custom-fields/)

 * 0 replies
 * 1 participant
 * Last reply from: [metallikat79](https://wordpress.org/support/users/metallikat79/)
 * Last activity: [10 years, 11 months ago](https://wordpress.org/support/topic/retrieving-custom-fields/)
 * Status: not resolved