Support

Account

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