Home › Forums › General Issues › Save/post data to Acf field default values? › Reply To: Save/post data to Acf field default values?
Hi @jwight1234
The easiest option is to use the repeater field to ‘repeat’ your custom field type. This involves no code updates to work.
If you want just 1 field on the page, which can save multiple values, then you need to add in multiple input
elements.
Currently, you should have an input that has a name attribute of $field[‘name’].
<input name="<?php echo $field['name'] ?>" value="something" />
To save multiple values as an array, you can change this to:
<input name="<?php echo $field['name'] ?>[]" value="val 1" />
<input name="<?php echo $field['name'] ?>[]" value="val 2" />
Adding in the extra []
to the name, allows you to save values as an array!
Thanks
E
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.