Home › Forums › General Issues › Taxonomy Term Image Field for Product Categories › Reply To: Taxonomy Term Image Field for Product Categories
Well, to get ACF values associated with a particular term, you have to pass an extra argument to
get_field(...) method to target the term ID. This argument can either be a term object or a term string as explained in the docs. The following code should work for you:
foreach($categories as $category): ... $image = get_image('image_field_name', $category); echo '<img src="'.$image['url'].'" alt="'.$image['alt'].'" />'; endforeach;
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!
🚀 This week’s session of ACF Chat Fridays dips into the preliminary results of our first ever user survey. Don’t miss it! https://t.co/3UtvQbDwNm pic.twitter.com/kMwhaJTkZc— Advanced Custom Fields (@wp_acf) May 9, 2023
© 2023 Advanced Custom Fields.