Support » Plugin: Advanced Forms for ACF » Image and Gallery pre-populate values

  • Resolved silentfred


    Hi there,

    Firstly, thank you for the great plugin and excellent documentation. It’s been a real pleasure working with it!

    I’d like to know what the best way is to pre-populate values for the image and gallery fields?

    This works perfectly fine with a page reload after form submit but i’d like to do the same on page load for a particular post. I’m using the values field for advanced_form(). Works fine for basic fields but not for images and gallery.

    Kind regards,

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author fabianlindfors


    Hi! Finally got around to test this out. Thank you for the kind words.

    The best way would probably be to pass an attachment ID to the form, or in the case of the gallery field an array of attachment IDs.

    I just tested it out with this code:

    advanced_form( 'form_5939a5c9c87bb', array(
      'values' => array(
        'gallery' => array( 604 ),

    The name of my gallery field is gallery and the attachment I wanted pre-filled has ID 604.

    Does this work for you?

    Thread Starter silentfred


    Hey Fabian!

    Worked like a charm! I can’t tell you how much better this is going to make the experience on my site! I love smashing my bugs like this =P

    • This reply was modified 4 years, 5 months ago by silentfred.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Image and Gallery pre-populate values’ is closed to new replies.