Support » Plugin: Gutenberg » How can I get the current state from my custom meta data?

  • How do I get the post meta data in Gutenberg? I have a custom meta box which shows in the document sidebar but I want to fetch the value of it’s current state so I can apply conditions to my custom block. Could you please provide an example as I don’t see any documentation on this.

    Look forward to your responses.

    Thank you.

Viewing 2 replies - 1 through 2 (of 2 total)
  • So I’m using this 'core/editor' ).getEditedPostAttribute( 'meta' )

    to return the meta data but my custom meta is not returning despite the value saved in the database.

    I also have the meta registered and set to show in the rest api as true but still nothing returning.

    What am I doing wrong?

    So it turns out register_meta does not work via init but via rest_api_init which I find out because I see two other plugins that register_meta fine using init so not sure why it did not work for me.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.