I want to be able to drag and drop a list of custom items in any order, similar to the WordPress navigation menu interface but instead of menu items each of my items simply needs to be uneditable text which I will define. The ideal scenario would be the following:
- A repeater field with minimum and maximum of 3 sub-fields
- Each sub-field contains 1 select field
- Each select field contains only 1 value : label
- Each select field is disabled
Image of what it may look like:

Notice that:
- Each select subfield has only one value
- Each select subfield has a distinct value
- Each select subfield is uneditable/disabled
If anyone has insight on how I may accomplish this either using the setup I proposed or perhaps using a different setup that may be more efficient I’d appreciate any input.
Thank you!
Hi @cfxd
Thanks for the question.
I’m sure this will be possible by hooking into the acf/prepare_field
filter and modifying the sub field’s value / disbaled settings.
Something like this should work:
$GLOBALS['acf_item_count'] = 0;
function acf_prepare_field_item( $field ) {
// set disabled
$field['disabled'] = 1;
// set value
if( empty($field['value']) ) {
// incease count
$GLOBALS['acf_item_count']++;
// set value
$field['value'] = $GLOBALS['acf_item_count'];
}
// return
return $field;
}
add_filter('acf/prepare_field/key=field_5600966e8fad1', 'acf_prepare_field_item', 10, 1);
The only issue is that by setting a select field to ‘disabled’, it won’t save it’s value… perhaps instead, you will need to change the $field['class']
to ‘disabled’, and then add some CSS / JS to prevent the select field from being clicked / changed.
Good luck
I’m kind of interested in hearing how this worked?
It seems to me no add-ons work with the newest, and I’d like to customize my repeater field to be more mobile-friendly, which this looks like it would be π
-Magnus
I compromised the feature that this logic was part of. If you figure out a way to get this working smoothly though please let us know!