Home Forums Add-ons Repeater Field Deleted row in repeater keeps showing


Deleted row in repeater keeps showing

  • Hi all,

    I have a repeater field in which I can show an image or a video.
    To select an image or video there is a radio switch to select one of the two.

    Radio switch

    Based on this radio switch there is a Conditional Logic to show either the input field for an image or for the video.

    Conditional logic

    The video’s are selfhosted on the domain (file sizes around 10mb, so no big deal).
    To get the video I use the field type ‘File’, so I have access to the ‘ID’ and ‘URL’ of the video.
    Works fine!

    But when I delete the row (when editing the post with the ACF fields) in WP the video is still shown on the front-end (all the data is still available).
    Is there an issue with the field type ‘File’ that causes this issue?
    I’ve tried all three Return Value options (Array, URL and ID) to see if that makes any difference, but it doesn’t.

    How can I make sure that when a row is deleted, the data of that row does not show up on the front-end?

  • What code are you using to show the video field?

    It’s a repeater field, so you should have loop

    if (have_rows('your field name')) ........
  • Hi John.
    Yes it is in a IF statement like you pointed out.
    But I think I’ve solved it already.
    I did a check if the image and/or video field was not empty, and if so, render it.
    But I also needed to check if the switch with the radiobuttons is present/set.
    So instead of:

    $image = get_sub_field('afbeelding');
    $video = get_sub_field('video');
    if ($image) {
    ... do something
    if ($video) {
    ... do something

    I now have this one:

    $image = get_sub_field('afbeelding');
    $video = get_sub_field('video');
    // This is the radio switch
    $image_or_video = get_sub_field('image_or_video');
    if ($image && $image_or_video == 'Afbeelding') {
    ... do something
    if ($video && $image_or_video == 'Video') {
    ... do something

    This solved the front-end rendering issue.
    But apparantly, even if you delete the row with the video, the data is still present.
    And that is strange, because it doesn’t happen when I delete a row with an image.

  • Conditional logic when a field is hidden the content is not removed, it is just hidden and not submitted.

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

The topic ‘Deleted row in repeater keeps showing’ is closed to new replies.