Blog

⭐️ Released v4.0 with Polylang mutations (PRO)

Leonardo Losoviz
By Leonardo Losoviz ·

Gato GraphQL v4.0 has been released. Check out the release notes in GitHub for the complete list of changes.

This version fixes a serious bug that made the plugin not work on PHP 8.2.

Concerning new features, the most important one belongs to Gato GraphQL PRO.

[PRO] Added Polylang Mutations

The new PRO module Polylang Mutations provides mutations for the integration with the Polylang plugin.

The GraphQL schema is provided with mutations to:

  • Establish the language for custom posts, tags and categories, and
  • Define associations among them (i.e. indicate that a set of custom posts, tags or categories is a translation for each other).
MutationDescription
polylangSetCustomPostLanguageSet the language of the custom post.
polylangSetTaxonomyTermLanguageSet the language of the taxonomy term.
polylangSaveCustomPostTranslationAssociationSet the translation association for the custom post.
polylangSaveTaxonomyTermTranslationAssociationSet the translation association for the taxonomy term.

For instance, the following query defines the language for 3 posts (to English, Spanish and French), and then defines that these 3 posts are a translation of each other:

mutation {
  post1: polylangSetCustomPostLanguage(input: {id: 1, languageBy: { code: "en" }}) {
    status
    errors {
      __typename
      ...on ErrorPayload {
        message
      }
    }
  }
  post2: polylangSetCustomPostLanguage(input: {id: 2, languageBy: { code: "es" }}) {
    status
    errors {
      __typename
      ...on ErrorPayload {
        message
      }
    }
  }
  post3: polylangSetCustomPostLanguage(input: {id: 3, languageBy: { code: "fr" }}) {
    status
    errors {
      __typename
      ...on ErrorPayload {
        message
      }
    }
  }
  polylangSaveCustomPostTranslationAssociation(input: {
    ids: [1, 2, 3]
  }) {
    status
    errors {
      __typename
      ...on ErrorPayload {
        message
      }
    }
  }
}

Want more posts & tutorials?

Receive timely updates as we keep improving Gato GraphQL.

No spam. You can unsubscribe at any time.