Support

Account

Home Forums ACF PRO Acf Pro repeater field returns null

Solved

Acf Pro repeater field returns null

  • Hello!

    I’m having a problem with the repeater field in Acf Pro. Basically, it works fine in the admin (it saves the data), but nothing shows up in the front.

    The name of the repeater field is logo_grid
    It has an image field inside (URL type) named logo_grid_img

    This is my code

    <?php if( have_rows('logo_grid_logos') ): ?>
    	<?php while( have_rows('logo_grid_logos') ): the_row(); ?>
    		<img src="<?php echo get_sub_field('logo_grid_img'); ?>">
    	<?php endwhile; ?>
    <?php endif; ?>

    I tried var_dump and it just returns null.

    <?php $my_var_dump =  get_field('logo_grid_logos'); ?>
    <?php var_dump($my_var_dump); ?>

    Also, I’m having the same problem both locally and in production.

    I’m quite desperate. I’m sure about the field names, and I’m using the exact same snippet in another website 🙁

  • It does look like it should be working.

    Can you give me a bit more information, what is the field group attached to? Is it a post or is it something else?

  • Hello,

    I solved the issue, it was actually my mistake: there was another query before the custom fields that needed to be reset.
    I posted the working snippet here: http://wordpress.stackexchange.com/questions/188440/acf-pro-repeater-field-returns-null

  • Great to hear you worked it out.

    ~JH

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

The topic ‘Acf Pro repeater field returns null’ is closed to new replies.