Home › Forums › General Issues › Retrieving image url through relationship › Reply To: Retrieving image url through relationship
I don’t know what
$image = $bank->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->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!
🚨 The 2023 ACF Annual Survey closes tomorrow! This is your last chance to complete the survey and help guide the evolution of ACF. https://t.co/0cgr9ZFOJ5— Advanced Custom Fields (@wp_acf) May 18, 2023
© 2023 Advanced Custom Fields.