title: Getting Return Value of NULL
body: <p>Hey folks I seem to be getting an NULL value returned for the 'mainEntity' => array() in the following peice of code. Tried everything anyone got any ideas? Thinking my variable isn't getting passed to the function correcty.</p>
  
  <pre><code>&lt;?php
    $schema = array(
      '@context'   =&gt; "https://schema.org",
      '@type'      =&gt; "FAQPage",
      'mainEntity' =&gt; array()
      );
  // Get Advanced Custom Fields Values 
      if ( have_rows('faq') ) {
        while ( have_rows('faq') ) : the_row();
        if ( have_rows('faq_section') ) {
          while ( have_rows('faq_section') ) : the_row();
            $questions = array(
              '@type'          =&gt; 'Question',
              'name'           =&gt; get_sub_field('faq_question'),
              'acceptedAnswer' =&gt; array(
              '@type' =&gt; "Answer",
              'text' =&gt; get_sub_field('faq_answer')
                )
                );
                array_push($schema['mainEntity'], $questions);
          endwhile;
        }
      endwhile;
      function faq_schema ($schema) {
        global $schema;
        echo '&lt;!-- FAQ Structured data --&gt;&lt;script type="application/ld+json"&gt;'. json_encode($schema) .'&lt;/script&gt;';
      }
      add_action( 'wp_footer', 'faq_schema', 100 );
    }
    ?&gt;`````
  </code></pre>