WordPress plugin that extends WPGraphQL to support querying (Gutenberg) Blocks as data.
This plugin is an extension of wp-graphql
, so make sure you have it installed first.
- Clone the repo or download the zip file of the project.
- Within the plugin folder use
composer
to install the vendor dependencies:
composer install
- Activate the plugin within WordPress plugins page.
Once the plugin is installed, you need can perform queries from within the GraphQLi
IDE Block data using the contentBlocks
field:
{
posts {
nodes {
# contentBlocks field represents array of Block data
contentBlocks {
# fields from the interface
renderedHtml
__typename
# expand the Paragraph block attributes
... on CoreParagraph {
attributes {
content
}
}
# expand a Custom block attributes
... on CreateBlockMyFirstBlock {
attributes {
title
}
}
}
}
}
}