Support

Account

Home Forums Add-ons Repeater Field Repeater within a repeater options page – grab data from first repeater loop Reply To: Repeater within a repeater options page – grab data from first repeater loop

  • Hi @tdoc42

    You are not supposed to loop trough the parent repeater again in your code. You should be able to get the ‘document_category2’ subfield after the child repeater loop. It should be something like this:

    while ( have_rows('documents2', 'option') ) : the_row();
          
        if ( have_rows('document_pages') ) :  
    
            while ( have_rows('document_pages') ) : the_row(); 
                $post_object = get_sub_field('document_page');
    
                if ($post_object->ID == $currentPageID) {
                    // do something here
                }
            endwhile;
            
        endif;
            
        // you can access the subfields of "documents2" again here
        $terms = get_sub_field('document_category2');
    
    endwhile;

    This page should give you more idea about it: https://www.advancedcustomfields.com/resources/working-with-nested-repeaters/.

    I hope this helps 🙂