Home › Forums › Add-ons › Repeater Field › Minimum Rows 1 empty fields shows as value › Reply To: Minimum Rows 1 empty fields shows as value
That’s because with 1 row, when you save the post ACF created the row and adds the blank content. So have_rows() is true and it loops through the rows to show them, even though they are blank.
You’ll need to loop though the fields to see if there’s actually anything in them before showing them
if( get_field('product_watt_replacement') ) {
while ( have_rows('product_watt_replacement') ) : the_row();
$value = get_sub_field('watt_replacement');
if ($value) {
$array2[] = get_sub_field('watt_replacement') .'w';
}
endwhile;
if (count($array2[])) {
$content .= '<tr><td>' . 'Wattage Replacement</td><td>';
$watt = implode(', ', $array2);
$content .= $watt .'</td></tr>';
}
}
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.