Getting started
Getting startedReplacing WPGraphQL

Replacing WPGraphQL

If your application is using WPGraphQL, it is possible to use Gato GraphQL instead.

The GraphQL schema from WPGraphQL and Gato GraphQL are similar but slightly different, so they need to be adapted.

The Next.js WordPress starter leoloso/next-wordpress-starter runs with either WPGraphQL or Gato GraphQL. The starter uses the same JS logic for either server, only the GraphQL queries are different.

This starter provides several examples of adapting the queries between the two servers. For instance, this WPGraphQL query:

fragment PostFields on Post {
  id
  categories {
    edges {
      node {
        databaseId
        id
        name
        slug
      }
    }
  }
  databaseId
  date
  isSticky
  postId
  slug
  title
}

...is adapted like this for Gato GraphQL:

fragment PostFields on Post {
  id
  categories: self {
    edges: categories(pagination: { limit: -1 }) {
      node: self {
        databaseId: id
        id
        name
        slug
      }
    }
  }
  databaseId: id
  date: dateStr
  isSticky
  postId: id
  slug
  title
}