Home › Forums › General Issues › get image from category custom field › Reply To: get image from category custom field
Hi @greencode
The code you use to populate $attachment_id
is OUTSIDE the sub categories loop. Therefor, it will not be dynamic for each category.
You need to move this within the loop.
You may find that the_category_ID
doesn’t work within the loop. You will need to use $category->term_id of something similar
Thanks
E
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.