Support

Account

Home Forums General Issues Trouble with resetting Reply To: Trouble with resetting

  • Ah-ah, I found a workaround. I just noticed now that the ACF relationship docs have a second option that doesn’t set postdata: http://www.advancedcustomfields.com/resources/field-types/relationship/

    /*
    *  Loop through post objects ( don't setup postdata )
    *  Using this method, the $post object is never changed so all functions need a seccond parameter of the post ID in question.
    */
     
    $posts = get_field('relationship');
     
    if( $posts ): ?>
    	<ul>
    	<?php foreach( $posts as $post_object): ?>
    	    <li>
    	    	<a href="<?php echo get_permalink($post_object->ID); ?>"><?php echo get_the_title($post_object->ID); ?></a>
    	    	<span>Post Object Custom Field: <?php the_field('field_name', $post_object->ID); ?></span>
    	    </li>
    	<?php endforeach; ?>
    	</ul>
    <?php endif;

    This helps me avoid the situation!