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
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.