Open speedwheel opened 5 years ago
Would also be interested in that. The problem with Gutenberg blocks is that it mixed the data with the markup. It's possible to store fields inside a block to post meta. This makes every single field accessible by its own.
Do you have any plans to introduce support for that?
Hi @speedwheel, @marcwieland95,
Sorry for the late response. This behavior currently isn't supported because Gutenberg has very limited support for meta fields. I'll leave this issue open for now so we can gather more feedback and ideas from the community.
An ideal solution would be adding a setting to the block store_as_post_meta( true )
, that would store the block data in post body wp-block references to the fields keys instead of the actual values.
Also maybe adding a setting to prevent existing blocks from "breaking" if the fields keys changes.
seems like ACF added this functionality recently
I'm not yet very familiar with the front end portion of how all of this works, but it does seem possible to instruct Gutenberg to read/store attributes using post meta instead of the standard JSON data in the post body.
From the link below...
attributes: {
author: {
type: 'string',
source: 'meta',
meta: 'author'
},
},
https://developer.wordpress.org/block-editor/developers/block-api/block-attributes/#meta
Is there any way to the post meta when using Gutenberg blocks? Same like we do with normal custom fields where we use
carbon_get_the_post_meta()
.Also what about having the fields available in the REST API?