Hi, I just wanted to add a note here as it’s the only thread I’m seeing about this recent usePostMeta feature, and I was fortunate to get to discuss some of the aspects (and limitations) of its current implementation (a/o v6.3.4) with one of the plugin developers. In particular, he noted that a block with the feature enabled must be “at the top level” in the editor and, thus, not nested in another block such as a column or group. In my current project, it would be extremely useful if one could nest one of these blocks in at least a limited set of other blocks (e.g. containers such as group, cover, and columns).
I honestly think this feature is a game-changer in that it allows combining the great editor experience provided by Gutenberg with the power of ACF fields- particularly, in associating the block fields at the post level to allow for querying by field content housed in a block within the post content. I look forward to the evolution of this great feature!
For anyone who might land on this thread, I managed to figure this out: I initially thought this issue might be related to using ACF blocks (as opposed to native blocks) but it actually derives from the theme, specifically the need for a theme.json file. I created a theme.json file at the root of my theme folder, added the following settings, and those options (spacing, dimensions, etc.) are now appearing:
{
"version": 2,
"settings": {
"appearanceTools": true,
"layout": {
"contentSize": "1170px",
"wideSize": "1440px"
},
"spacing": {
"margin": true,
"padding": true
}
}
}
Thanks for your reply, @hube2 – I ended up using the init hook as indicated in your example, and I also made use of the add_option() / get_option() functions to force the utility function to run only once, as described in this post. For any others who may stumble across this thread and need to do something similar (e.g. utility function to update the content of a field for all posts), this approach worked well for me.
I can also confirm the update works- phew!
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.