• The Events Calendar plugin, when you configure it to use gutenberg blocks, seems to store some of its block types into wp_content as JSON, like this:

    <!– wp:tribe/event-organizer {“organizer”:420} /–>

    I am building a site that converts WP content into graphql, and the part that renders blocks into graphql is choking on this sort of thing.

    In order to figure out how to get started, I am wondering if someone can tell me whether what Tribe Events is doing in the example above is considered to be an acceptable approach to Gutenberg development, or whether they are violating any best practices by doing that.

Viewing 1 replies (of 1 total)
  • Plugin Author Daniel Richards

    (@talldanwp)

    @jrotering The JSON structure you’re seeing is standard in the block editor.

    The HTML comment is called a block delimiter, and that comment can also include a JSON object of data. The event organizer block looks like a dynamic block (rendered server-side), so it’s self closing and has no content. When a post is loaded the server-side render callback is triggered to produce the appropriate HTML content.

    It’s difficult for me to advise on the given information, but you might consider using the block parser to retrieve data about blocks in a post:
    https://github.com/WordPress/gutenberg/tree/master/packages/block-serialization-default-parser

Viewing 1 replies (of 1 total)
  • The topic ‘JSON stored in raw wp_content for gutenberg blocks’ is closed to new replies.