I'm trying to achieve to display the entries to a new post. I'm using nested forms

What I want to achieve is to display only what values, not all the entries. The main problem is I’m not getting the child form entries, insted I am getting the values on the parent form where the nested form is there. Can anyone encountered this one? thanks in advance

  // Retrieve the form object and get the form ID
          $form = GFAPI::get_form(2); // Replace 1 with the actual form ID of your nested form
    
    // Check if the form exists
    if ($form) {
        $form_id = $form['id'];

        // Retrieve the nested form entries for the specific post
        $nested_form_entries = GFAPI::get_entries(array(
            'form_ids' => [$form_id],
            'field_filters' => array(
                array(
                    'key' => 'source_page',
                    'value' => get_the_ID(),
                ),
            ),
        ));


   <h3>Ingredients:</h3>
                  <ul>
                      <?php foreach ($nested_form_entries as $entry) : ?>
                          <li>
                              <strong><?php echo esc_html($entry['2']); ?></strong> <!-- Field ID 1 represents the "Ingredients" field -->
                              <?php echo esc_html($entry['3']); ?> <!-- Field ID 2 represents the "Amount of Ingredient" field -->
                              <?php echo esc_html($entry['4']); ?> <!-- Field ID 3 represents the "Unit of Measurement" field -->
                          </li>
                      <?php endforeach; ?>
                  </ul>

kindly see attached file

Hello @Echoecho, are you trying to get the parent entry and expecting the child entry data to be populated in the parent entry object?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.