Home › Forums › General Issues › Defining field wrapper ID › Reply To: Defining field wrapper ID
Sorry, did not see your follow up question. For some reason I stopped getting notification, not sure why.
Anyway, giving each field in a repeater a unique value is somewhat harder. You need to have a way to keep track of the last value you assigned and increment it. I think something like this could work.
function my_acf_load_field($field) {
static $count = 0;
$count++;
$field['wrapper'] = array(
'id' => 'unique_'.$count;
);
return $field;
}
add_filter('acf/load_field/key=field_123', 'my_acf_load_field');
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.