I have run into this issue as well. Have not tried the get_post_meta (this gets messy with repeaters!!!).
I posted on stack overflow and had another developer help me troubleshoot.
http://wordpress.stackexchange.com/questions/180424/multisite-wp-query-switch-to-blog-issue
I’m going to try to reproduce this on a fresh multisite install with a simplified test case.
I have run into this issue as well. Have not tried the get_post_meta (this gets messy with repeaters!!!).
I posted on stack overflow and had another developer help me troubleshoot.
http://wordpress.stackexchange.com/questions/180424/multisite-wp-query-switch-to-blog-issue
I’m going to try to reproduce this on a fresh multisite install with a simplified test case.
Glad I found this thread! I was trying to combine a relationship field and have that place a pin on the map. Here’s the code I have that works for me:
<?php $posts = get_field('featured_space'); if( $posts ): ?>
<div class="acf-map">
<?php foreach( $posts as $post): // variable must be called $post (IMPORTANT) ?>
<?php setup_postdata($post); ?>
<?php $space_address = get_field('space_address', $post->ID); ?>
<div class="marker" data-lat="<?php echo $space_address['lat']; ?>" data-lng="<?php echo $space_address['lng']; ?>">
<h4><?php the_title();?></h4>
<p><?php echo $space_address['address']; ?></p>
</div><!--/.marker-->
<?php endforeach; ?>
<?php wp_reset_postdata(); // IMPORTANT - reset the $post object so the rest of the page works correctly ?>
</div><!--/.acf-map-->
<?php endif; ?>
Or if that does not work here’s a link to a gist with the code: Gist
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.