WordPress GraphQL

Hi everyone! Love WordPress? Interested in GraphQL?

There are many projects starting to creep up to push GraphQL support forward for WordPress.  I will be throwing my hat into the ring as well, because I feel it will greatly expand interest in WordPress and provide some awesome functionality to it.  Today I started up a plugin that will provide a GraphQL API for WordPress.  Head over to GitHub to check out WP GraphQL!  I am incredibly excited about this project and hope you will be too. Hopefully, we can build something amazing together!  If you are interested in contributing, go to the GitHub repository linked above and comment on this issue and introduce yourself; feel free to post any questions you might have as well.  I will get back to you as soon as I can.

What is GraphQL and why does it matter?

GraphQL is a new specification, created by Facebook, that can be used to create an easy way to reason about your application. One of its biggest strengths lies in the ability to specify exactly what you want client side and have it be taken care of in one request! This makes matching data to what you need in your UI much, much easier. Lets look at a made up example.  Imagine we are going to make a single post view for a WordPress site. A GraphQL query might look like this:

  post(id: 7) {
    author {
    comments {
      author {

You would send this as a string to the GraphQL API endpoint, and in return you would get JSON data giving you the post title, content, author name and gravatar for post number 7. You would also get back a list of comments for the post each with their matching content and author’s name and avatar. It is probably more clear why potential GraphQL queries are so powerful. You can declare what you want client side and bring the JSON data you need into whatever language you want to use. When work on WP GraphQL is further along, I plan to use it for a lot of JavaScript based projects!

More to come in the future!

I am just overwhelmed with excitement about this project and hope that you will feel the same.  Don’t be intimidated by something new. I strongly encourage you to try and contribute to this project. I will personally try to help as much as I can.  We will both be learning GraphQL alongside each other as we go; which should be awesome!

Let me know if you are excited about bringing GraphQL to WordPress as I am!  If you are having trouble installing the plugin open an issue on the WP GraphQL github repository.

Leave a Reply

%d bloggers like this: