title: How do I get Post Object data form Wordpress ACF - Flexible Content field
body: <p>Using Advanced custom field plugin I have a custom post type that has various custom fields assigned to it.</p>
  
  <p>I'm trying to output all of the data that is contained in the flexible content field "content"</p>
  
  <p>I have it outputting "text_ad" ok but for some reason i can't figure our the "newsletter_article" which is a post object - Any direction to getting this working would be amazing.</p>
  
  <p>Read this <a href="https://www.advancedcustomfields.com/resources/flexible-content/" rel="nofollow noreferrer">https://www.advancedcustomfields.com/resources/flexible-content/</a> and this <a href="https://www.advancedcustomfields.com/resources/post-object/" rel="nofollow noreferrer">https://www.advancedcustomfields.com/resources/post-object/</a></p>
  
  <pre><code>&lt;?php
  // check if the flexible content field has rows of data
  if( have_rows('content') ):
  
   // loop through the rows of data
  while ( have_rows('content') ) : the_row();
  
      if( get_row_layout() == 'text_ad' ):
  
          echo the_sub_field('text_ad_title');
          echo the_sub_field('text_ad_url');
          echo the_sub_field('text_ad_description');
  
      elseif( get_row_layout() == 'newsletter_article' ): 
  
          $post_object = get_sub_field('the_newsletter_article');
              if( $post_object ):
                     $post = $post_object;
                     setup_postdata( $post );?&gt;
                     &lt;strong&gt;&lt;a href="&lt;?php the_permalink(); ?&gt;"&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/strong&gt;
  
             &lt;?php 
             wp_reset_postdata();
             endif;
  
      endif;
  
  endwhile;
  
  else :
  
  // no layouts found
  
  endif;
  ?&gt;
  </code></pre>