Have any question about developing blocks for Gutenberg or the Block Editor? We’ve answered the most common Gutenberg questions in the simplest way.

How can I use post meta with Gutenberg blocks?

To store a Gutenberg block’s attributes in post meta, you can set its source attribute to meta. In addition you need to register the post meta field and make it available via the REST API. WordPress will then read and store the attribute’s value in post meta without you needing to write any further code.

For further information check the Attributes section or the Use Post Meta Data tutorial in the Gutenberg Developer Documentation.

How can I fix the “TypeError: wp.editor is undefined” error?

This error message means that the wp.editor variable is not defined. To fix this, you need to add the wp-editor handle as script dependency for your Gutenberg block JavaScript.