Insights

Gatsby & WordPress – 2.3. – WPGraphQL

13/11/2019 by Jack Pritchard

WPGraphQL

After installing the WPGraphQL plugin from Github, and installing it, we will now have access to a new endpoint in our WordPress environment. The endpoint is the name of your site with /graphql at the end of the URL.

When you first access this endpoint you'll be met with a confusing error which says that you need to provide at least a query or queryId.

This is because GraphQL is a very explicit querying language and required you to be specific with what data you want to be returned before it returns any payloads.

To get an understanding of the schema we do have available to us, we'll be using the WPGraphiQL plugin within our WordPress admin dashboard.

With the plugin, we'll query the posts available on our website and return the ID, date, slug, and title of each post using GraphQL and getting a JSON payload response.

Continue Reading 📚