Home › Forums › General Issues › Get ACF Category Image into Shortcode Loop › Reply To: Get ACF Category Image into Shortcode Loop
the image of the sub category or the image of the parent category
this is correct for the parent term
$image = get_field('category_image', $current_cat );
this would be used for the child term
$image = get_field('category_image', $child );
however, this may not be returning what you expect it to return, and what it is returning would depend on where you are adding the shortcode.
$current_cat = get_queried_object();
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.