Support

Account

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>';