WPGraphQL
Interacting with WordPress Data in a new way
WordCamp Phoenix 2018
WIFI: GEvents | GEvents515
Who Am I?
- Senior WordPress Engineer at Digital First Media in Denver, CO
- WordPress developer for 9+ years
- GraphQL Developer for ~1.5 years
- Denver Native
- Creator & maintainer of WPGraphQL
Agenda
- What is GraphQL?
- WordPress as an Application Data Graph
- Using the WPGraphQL Plugin
- Extending WPGraphQL for your needs
- WPGraphQL in the wild
GraphQL
A Query Language for your API
GraphQL is a query language for APIs and a runtime for fulfilling those
queries with your existing data. GraphQL provides a complete
and understandable description of the data in your API, gives
clients the power to ask for exactly what they need
and nothing more, makes it easier to evolve APIs over time,
and enables powerful developer tools
GraphQL
Graph != Graph Databases
Graph != Graph Search
Graph = Application Data Graph
QL = Query Language
GraphQL: A Query Language for Your Application Data Graph
GraphQL
{
me {
name
}
}
{
data: {
me: {
name: "Jason Bahl"
}
}
}
GraphQL Query
GraphQL Result
Post
Category
Category
Category
Post
title
"Hello World"
title
"GoodBye Mars"
Image
Image
Image
name
"news"
name
"crime"
name
"sports"
Image
WordPress as an Application Data Graph
GraphQL
GraphQL lets us pick trees out of the Application Data Graph
GraphQL
query {
post(id: "...") {
title
link
categories {
nodes {
name
}
}
}
}
{
data: {
post: {
title: "Hello World!"
link: "http://site.com/hello-world"
categories: {
nodes: [
{
name: "sports"
},
{
name: "crime"
}
]
}
}
}
}
Post
Category
Category
Category
Post
title
"Hello World"
title
"GoodBye Mars"
Image
Image
Image
name
"news"
name
"crime"
name
"sports"
Image
WordPress as an Application Data Graph
WPGraphQL is a free, open-source WordPress plugin that provides an extendable GraphQL schema and API for any WordPress site.
We have stickers!
How to use GraphQL with WordPress
Posts
Pages
Users
Comments
Terms
Media
Adding the Plugin to WordPress
- Visit Github:
- Star the Repo
- Tweet about how awesome it is to be able to use GraphQL with WordPress
- Clone or Download the plugin
- Install & Activate
Install & Activate the Plugin
Contributors
WPGraphQL in the Wild
WordCamp Phoenix
By Jason Bahl
WordCamp Phoenix
- 3,490