Support

Account

Home Forums General Issues Display custom field value from another post type Reply To: Display custom field value from another post type

  • Thanks ! This is works:

    <?php
    
    $post_object = get_field('project_name');
    
    if( $post_object ): ?>
    
        <div>
        	<h4><?php echo get_the_title($post_object->ID); ?></h4>
            <span>Post Object Custom Field: <?php the_field('project_description', $post_object->ID); ?></span>
        </div>
        <?php wp_reset_postdata(); // IMPORTANT - reset the $post object so the rest of the page works correctly ?>
    
    <?php endif; ?>