termsObjectsToString(get_the_terms($post, $field['value'])); } protected function termsObjectsToString($terms, $termMeta = null) { if ($terms && !is_wp_error($terms)) { $terms = array_map(function ($term) use ($termMeta) { return empty($termMeta) ? $term->name : get_term_meta($term->term_id, $termMeta, true); }, $terms); return implode(', ', $terms); } return null; } }