'; $term_count = 0; foreach ($terms as $term) { $term_link = get_term_link($term->slug, $taxonomy); if (!empty($term_link) && !is_wp_error($term_link)) { if ($term_count != 0) $output .= ', '; $output .= '' . $term->name . ''; $term_count = $term_count + 1; } } $output .= ''; } } echo $output;