Home Forums Add-ons Repeater Field Empty Repeater Field displays container


Empty Repeater Field displays container

  • Note I also posted this at

    Hi everyone,

    I ran into an issue with Advanced Custom Fields where an empty container is displaying instead of the “else” statement after the content has been removed from the container. So to be clear it once had information but that information was deleted.


    I’m pretty sure my has an error can anyone see my mistake in the php below?

    	// check if the accordion repeater field has rows of data
    	if( have_rows('accordion') ): ?>
     	<?php // loop through the rows of data
    	    while ( have_rows('accordion') ) : the_row(); ?>
    		<div class="section-container accordion content" data-section="accordion">
    				<p class="title" data-section-title><strong><a href="#"><?php the_sub_field('accordion_title'); // accordion title acf ?></a></strong></p>
    		<div class="content" data-section-content>
    			<?php the_sub_field('accordion_content'); // accordion content acf ?>
    	else :
    	    // no rows found
  • I just sent in a support ticket with the same issue. I recently upgraded to pro from the 4.x line with the paid repeater add on. Even though I have no rows, it is still rolling as if there is content. I will paste my code below. When I did the upgrade, I did not notice this. I happened to update to 5.1.1 this morning, so it may just be an issue with the recent release. Or this was there on Monday when I upgraded from 4.x to 5.1 and I missed it.

    $i = 0;

    if( have_rows(‘program_content_sections’) ):

    while ( have_rows(‘program_content_sections’) ) : the_row();
    echo ‘<section class=”prog-section-‘ . ++$i . ‘”><div class=”wrap in-page”>’;
    echo ‘</div></section>’;

    else :
    // no rows found


  • Hi clburch,
    I updated to 5.1.1 this morning and didn’t consider that could be the issue. the blog states a fix to the repeater field.

    “Field group: Fixed bug where sub fields were deleted when moving a repeater field to another group”

    Perhaps that same fix is causing deleted fields to display null content. I poked around to create variables

    		$title = get_sub_field('accordion_title' ); // get the title
    		$content = get_sub_field('accordion_content'); // get the content

    That results in a 0 instead of empty space. Different error same problem the variable is empty.

  • This reply has been marked as private.
  • This reply has been marked as private.
  • I downgraded from ACF Pro 5.1.1 to 5.1.

    Downgrading fixed the problem. I’ll wait until the next version to upgrade 🙁

  • I’m having this same issue with 5.1.1

  • Thanks for your effort josephd. I just rolled back to 5.1 and the problem is gone. Waiting for 5.1.2.

  • I just upgraded to 5.1.2 and this appears to be fixed. 😀

  • Thanks Legin76, I’m updating now 🙂

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

The topic ‘Empty Repeater Field displays container’ is closed to new replies.