Home › Forums › Front-end Issues › Display value for taxonomy term text in categories
Hello,
Thanks for this amazing plugin ! I have one problem. I use Taxonomy Term in category with text field. I have the field in back office but I don’t know they can’t display value in front.
I use this <?php get_field('petite_description_cat');?> but nothing happen…

Can you help me ?

Hi @wecandoit
To show the custom field value from a taxonomy term, kindly follow this guide: https://www.advancedcustomfields.com/resources/get-values-from-a-taxonomy-term/.
I hope this helps 🙂
I ever triyed to follow this tuts but it doesnt work or i dont understand all… By the way I m french :s
I just wanna display petite_description_cat on each category if petite_description_cat is here.
Any idea ?

Hi @wecandoit
The code depends on where you assign the custom fields.
Based on your previous code, the code should have this structure:
<?php echo get_field('petite_description_cat', '$taxonomy_$termID');?>
You can get the $taxonomy and $termID value by checking the URL when editing the term. I’ve attached a screenshot for your reference.
As you can see in the screenshot, there are taxonomy=categoryand tag_ID=10. So if you assign the custom field to a category with ID of “10”, then you need to do it like this:
<?php echo get_field('petite_description_cat', 'category_10');?>
If you don’t know how to code and don’t have time to learn it, I suggest you hire a developer to help you out.
I hope this makes sense 🙂
Thanks for this help.
After lot of experimentation i found this
<?php echo get_field('petite_description_cat', 'category_' . $cat);?>
And it’s work. I don’t if this method is good but that’s work.
The topic ‘Display value for taxonomy term text in categories’ is closed to new replies.
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.