Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

ACF taxonomy display name

I have this code, and it gives me the id:

if( get_field('medarbejder') ): ?><?php the_field('medarbejder'); ?><?php endif; ?>

I want to display the name of the taxonomy, how do i proceed?

2 Answers

Kevin Korte
Kevin Korte
28,149 Points

According to their documentation: http://www.advancedcustomfields.com/resources/field-types/taxonomy/

You'd have to do something like this

$terms = get_field('taxonomy_field_name');
<h2><?php echo $term->name; ?></h2>

Yeah, I have tried with that. Provides the same result only the ID.