Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
78 lines (71 sloc) 1.6 KB
title description
WPGraphQL Gutenberg
Expose Gutenberg content in the WPGraphQL Schema

WPGraphQL Gutenberg

This plugin exposes gutenberg structured content through wp-graphql. More information available here.

Query Example

query posts {
  postBy(slug: "hello-world") {
    id
    blocks {
      __typename
      ... on CoreHeadingBlock {
        name
        attributes {
          __typename
          ... on CoreHeadingBlockAttributes {
            content
            level
          }
        }
      }
      ... on CoreParagraphBlock {
        name
        attributes {
          __typename
          ... on CoreParagraphBlockAttributes {
            backgroundColor
            content
          }
          ... on CoreParagraphBlockAttributesV3 {
            fontSize
            content
          }
        }
      }
    }
  }
}
{
  "data": {
    "postBy": {
      "id": "cG9zdDox",
      "blocks": [
        {
          "__typename": "CoreHeadingBlock",
          "name": "core/heading",
          "attributes": {
            "__typename": "CoreHeadingBlockAttributes",
            "content": "Welcome to WordPress.",
            "level": 2
          }
        },
        {
          "__typename": "CoreParagraphBlock",
          "name": "core/paragraph",
          "attributes": {
            "__typename": "CoreParagraphBlockAttributesV3",
            "fontSize": null,
            "content": "Welcome to WordPress. This is your first post. Edit or delete it, then start writing!"
          }
        }
      ]
    }
  }
}
You can’t perform that action at this time.