Updated 25.03. : Some function names changed in the latest beta version.
ACF 5.8 Beta introduced an easy way to create your custom Gutenberg blocks. I am already using it heavily for a current project, to easily organize content and media assets.
Really powerful, when combined with Timber as well, which has been the foundation of many of my themes for years now ;)
Organizing data using ACF is nice, but sometimes you seek access to that saved block data directly. I hate it when I am confined to boundaries and the data flow is restricted or hidden. I need things to be accessible to choose the creative flow myself.
There you go, enjoy some free block data :)
I was a big skeptic, when it comes to WordPress and the new Gutenberg editor, but combined with ACF + Timber its pure magic :) Looking forward to things to come!
Just missing something here. Where do you find the block ID?
$block[‘attrs’][‘id’] holds the ID of the block.
Thanks! I understand. Seems last update broke “acf_setup_postdata”… We’ll need to find another way…
Hi, function names changed in the latest version.
// Setup postdata allowing get_field() to work. acf_setup_meta( $block['data'], $block['id'], true );
// Reset postdata. acf_reset_meta( $block['id'] );
The relevant reference code, can be found in pro/blocks.php
Yes thanks! I juts find out! :)
You saved me from going crazy with this article. Thank you!!!
Glad I did, we are all crazy enough already :) Alex