Home › Forums › General Issues › How to show category information on single post › Reply To: How to show category information on single post
You need to specify the id value that ACF needs to get the field https://www.advancedcustomfields.com/resources/adding-fields-taxonomy-term/
<?php
$categories= get_the_category();
if (!empty($categories)) {
$term_id = $categories[0]->term_id;
$image = get_field('category-image-field', 'term_'.$term_id);
// what you do from here depends on what the field is returning
}
?>
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.