Hello,
there seems to be a bug, when using cloneable field in a settings page. When I already have some items in my list and I remove one of the first items (not the last item) I am not able to add any item to my list anymore.
There seems to be a problem with the indexes. They are not sanitized properly. When I delete i.e. the second item in a list of 3 items the remaining indexes are 0 and 2 (instead of 0 and 1). When adding a new item its index is also 2 and overwrites the existing item with same index.
This problem does not occur when adding the same metabox to a post.
This is my simple cloneable field:
array (
0 =>
array (
'name' => 'My name',
'id' => 'my-id',
'type' => 'select',
'placeholder' => '- Please select -',
'clone' => true,
'max_clone' => 4,
'sort_clone' => true,
'options' =>
array (
'option1' => 'option1',
'option2' => 'option2',
'option3' => 'option3',
'option4' => 'option4',
),
'std' =>
array (
0 => 'option1',
1 => 'option2',
2 => 'option3',
3 => 'option4',
),
)
);