Ollie Block Academy

Dealing with Post Meta

Updating Post Meta in a Block

Update post meta through the editPost action creator from useDispatch, passing an object with meta property containing the key-value pairs to update. This modifies the editor store, not the database directly.

Use supports: { multiple: false } in block.json to prevent multiple instances of meta-managing blocks, ensuring data consistency when multiple blocks could write to the same meta field.

The editPost action updates the current post’s meta in the editor store. Changes appear immediately in the interface but require saving the post to persist changes to the database.

Back to: Ollie Block Academy > Dealing with Post Meta