I know to get the ACF fields of a post it's self but I'm having trouble getting relationships within those results to return ACF fields as well.
$args = array( 'post_type' => 'location', 'post__in' => array(67) ); $q = new WP_Query($args); $locations = array(); while($q->have_posts()) : $q->the_post(); $p = get_post(); // gets the basic post details $f = get_fields(); // gets the ACF details $m = array_merge((array)$p, (array)$f); // merges all details into one array array_push($locations, $m); endwhile;
which shows something like
Array (  => Array ( [ID] => 67 [ACF_Field => This is a custom field/value. ... [ACF_Relationship_Field] => Array (  => WP_Post Object ( [ID] => 133 // there should be another [ACF_Fiel]/value here ... ) ) ) )
So the first level of array has the ACF Values in it but you can see that the second level does not. I looked at the ACF Reference as that's helped me get to this point but unfortunately I haven't found anything that will pull in a relationships with ACF fields attached.