Support

Account

Home Forums Add-ons Repeater Field Insert values of a repeater into an array

Helping

Insert values of a repeater into an array

  • I just want to run through the repeater and insert the values into my array but when I try to do it they all show up as NULL. I can echo the values just fine so I know the repeater is working but if I try to add it to the array it just shows NULL. I know there is something easy that I’m missing but after allot of Google searches I am still clueless on how to do this. I would really appreciate any help that any one can give me. Below is the code I am trying to use.

    <?php if(get_field('ips_to_allow')): ?>
    <?php while(has_sub_field('ips_to_allow')): ?>
    
    <?php $allow[] = the_sub_field('ip_address'); ?>
    
    <?php endwhile; ?>
    <?php endif; ?>
    
    <?php var_dump($allow); ?>
  • This might help.

    <?php $allow[] = get_sub_field('ip_address'); ?>

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Insert values of a repeater into an array’ is closed to new replies.