Course lesson

Expose Gutenberg Blocks to the Headless WordPress GraphQL Endpoint

The same problem occurs as the previous lesson with the blocks that Gutenberg exposes in our API with the GraphQL endpoint.

Duration
2 min
Access
Pro
Transcript
Available

The same problem occurs as the previous lesson with the blocks that Gutenberg exposes in our API with the GraphQL endpoint.

In this lesson, we will show how to expose the Gutenberg Block data to the GraphQL layer by adding the wp-graphql-gutenberg plugin. There are a couple of things to note about the plugin. Whenever you use a new block type in your editor, you will have to update the blocks registry in the plugin so that it properly exposes the data in GraphQL. Also, when you query for block data you will need to be explicit in the attributes that you request. This behavior is different from REST where REST will serve you all the data available.