Home › Forums › ACF PRO › switch_to_blog problem › Reply To: switch_to_blog problem
I’m not sure how this is working correctly at all by looking at the code you’ve provided
<?php
switch_to_blog(2);
// ACF will be using the current post ID here
// that current post ID is the post on the current site which may
// be a different post with the same ID on the site you are switching to
// I can only guess that this is somehow causing the post ID to get lost
$tallimage2 = get_field('tall_image_2');
if( $tallimage2 ): ?>
<img src="<?php echo $tallimage2['image2']; ?>">
<p class="mb0"><?php echo $tallimage2['caption2']; ?></p>
<?php endif; ?>
<?php restore_current_blog(); ?>
I would start by seeing what the post is before and after your call by outputting the global $post value before and after
global $post; echo '<pre>'; print_r($post); echo '</pre>';
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.