Support

Account

Home Forums General Issues Trouble getting post object data to appear in front end Reply To: Trouble getting post object data to appear in front end

  • Hi @overachiever

    Can you debug the $post_object value?

    
    $post_object = get_field('post_object');
    
    echo '<pre>';
    	print_r( $post_object );
    echo '</pre>';
    die;
    

    Next, Try the code without using the setup_postdata function:

    
    <?php
    
    $post_object = get_field('post_object');
    
    if( $post_object ): ?>
    	<div>
    		<h3><?php echo get_the_title( $post_object->ID ); ?></h3>
    		<span>Post Object Custom Field: <?php the_field('adlinks', $post_object->ID ); ?></span>
    	</div>
    <?php endif; ?>