Home Forums Front-end Issues Display the name of taxonomy


Display the name of taxonomy

    • jf

    • November 20, 2019 at 8:19 pm

    I have create a field type taxonomy
    I want to display the name of this category on front end
    with: <?php the_field(‘taxonomy’); ?>
    but it return a number ( Id ?) and not the name of the taxonomy
    What is the PHP code ?

    also i want to return the url of this taxonomy ? What is the PHP code ?

    Thanks !

  • Hi JF,
    You can try this one, it should works:

    <?php $term = get_field('taxonomy');
    if( $term ): 
    echo $term[0]->name;
    endif; ?>
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.