Home › Forums › General Issues › Retrieving image url through relationship › Reply To: Retrieving image url through relationship
I don’t know what
$image = $bank[0]->bank_logo;
is getting, but you can’t get an image field from a related post this way.
Code here depends on what the relationship is returning. I am assuming that you have it set to return a post object
$bank = get_field('bank_institution', $id);
$image = get_field('bank_logo', $bank[0]->ID);
You need to use the ID of the related post to get the field from that post
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.