Home › Forums › General Issues › Defining field wrapper ID › Reply To: Defining field wrapper ID
Yes. For example, say I have a repeater containing a text field, and on the edit page I add 5 repeater rows. I want to target the text fields and give them each a unique wrapper ID.
Currently my code looks like this:-
function my_acf_load_field( $field )
{
$field['wrapper'] = array(
'id' => 'unique_id'
);
return $field;
}
add_filter('acf/load_field/key=field_123', 'my_acf_load_field');
With field_123 being the text field. But this will give all 5 text fields the same ID: ‘unique_id’. What I would like is for each text field to have a sequential ID. for example “unique_id_1′, ‘unique_id_2’… etc.
Any ideas?
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.