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>';
}
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.