Support

Account

Home Forums Front-end Issues How to display taxonomy labels Reply To: How to display taxonomy labels

  • A taxonomy field can either return term object or term id. From what is being displayed I’m assuming that you are returning term id and you should change this to term object. Then you’ll need to loop through the array that’s returned and echo the term names.

    
    $terms = get_field('expertise_new');
    if ($terms) {
        echo '<span class="acf-field">Expertise:</span>
        echo <span class="acf-value">';
        $term_names = array();
        foreach ($terms as $term) {
            $term_names = $term->name;
        }
        echo implode(' | ', $term_names),'</span><br>';
    }