Support

Account

Home Forums Gutenberg Adding ACF blocks to a block template Reply To: Adding ACF blocks to a block template

  • Hey Guys,

    This is possible already.

    Here is the post about it:
    https://support.advancedcustomfields.com/forums/topic/programmatically-set-blocks-initial-value/

    And the code which helps you to make better experiences! : )
    The magic is that, you need to wrap them with a data []

    'template' => [
         ['acf/my-block', [
           'data' => [
            'field_name' => 'the value you want to see by default',
           ]
         ]]
    ];

    I hope it helps you too as well!

    I’m stuck with repeater subfields now.
    Didn’t find a way to fill them yet.
    If any of you able to do that, don’t hesitate to write here about that. 😉

    Bests,
    Christian