Home Forums General Issues setup_postdata inside anothe setup_postdata Reply To: setup_postdata inside anothe setup_postdata

  • Finally, I resolved it like this, on the second query inside the loop

    <?php $negatives = get_field( "collections_single_work"); ?>
    <?php if( $negatives ): ?>
    <?php foreach( $negatives as $post ): ?>
    <?php setup_postdata($post); ?> 
    here goes some coding 
    <?php $related_posts = get_field('collection_edition_size');
    if ($related_posts) {
      foreach ($related_posts as $related_post) {
    <?php if( get_field('size_of_the_negative', $related_post->ID) == '4x5'): ?>
    here goes some coding 
    } ?>
    here goes some coding which is part of the first loop 
    <?php wp_reset_postdata(); endforeach; ?>
    <?php endif; ?>