PHP Wordpress Redux Framework metaboxes not removing all items from repeater block

54 views Asked by At

I am trying to remove all items present in a repeater block in a custom wordpress post type. But for all of the options present in my configuration it is always keeping the first element of the repeater block.

For example - I have a section defined as follows:

protected function retailerLinks() {
      return (new Section())
        ->SetLabel('Retailer Links')
        ->AddFields(
          (new Repeater())
            ->SetLabel('Retailer Links')
            ->SetItemName('retailer_links-retailer-retailer')
            ->SetSortable(true)
            ->SetItemName('Retailer')
            ->AddFields(
              (new Select())
                ->SetId('retailer_links-retailer-retailer')
                ->SetLabel('Retailer')
                ->SetData('terms')
                ->SetArgs(['taxonomies' => ['retailer']])
                ->SetSelected(''),

              (new Text())
                ->SetId('retailer_links-retailer-link')
                ->SetLabel('Link')
            )
        );
    }

But whenever I am trying to remove all the options from the list, it keeps the first one and deletes the rest.

I am trying to find out why this may be happening, so if anyone can help identify / help fix the root cause of this issue it would be very helpful.

Also attaching a demo of the issue I am facing here (demo link) to help better understand the issue I am facing.

1

There are 1 answers

0
Stevemats On

This issue is likely due to a JavaScript code error in the handling of the repeater block functionality on the client side. You might need to check and modify the JS code responsible for removing items, ensuring that the first element is not preserved when all items are deleted to see if that fixes the issue.