Support

Account

Home Forums Add-ons Repeater Field Trying to get values from nested repeater in admin area Reply To: Trying to get values from nested repeater in admin area

  • The problem is that ACF does not know what post you want to get the field from

    
    add_action('wp_ajax_email_sender', 'email_sender');
    function email_sender($field) {
       // move this to the top
        $post_id = $_POST["post_id"];
    
        if( have_rows('day_repeater', $post_id) ):
            // loop through the rows of data
            while ( have_rows('day_repeater', $post_id) ) : the_row();
    
            $date = get_sub_field('date'); // I need values from this field
            
                // LOOP FOR NESTED REPEATER FIELD
                if ( get_field('accommondation') ):
                    while( has_sub_field('accommondation') ) : the_row();
                    
                    $notes = the_sub_field('notes'); // I need values from this field
    
                    endwhile;
                endif;
            endwhile;
        endif;