graphql polylang code example

Example: graphql polylang

query PolylangExample {
    # Filter pages by language. If not set it defaults to ALL
    pages(where: { language: EN }) {
        nodes {
            title

            # Get language of each page
            language {
                code # Language code
                name # Human readable name of the language
            }

            # Get links to the translates versions of each page
            # This is an array of post objects
            translations {
                title
                link
                language {
                    code
                }
            }
        }
    }

    # Taxonomies such as tags can be filtered like post objects
    tags(where: { language: EN }) {
        nodes {
            name
            language {
                code
                name
            }
        }
    }

    # Get translated version of a given menu
    menuItems(where: { language: EN, location: FOOTER_MENU }) {
        nodes {
            url
        }
    }

    # Get the default language
    defaultLanguage {
        name
        code
    }

    # Get all configured languages
    languages {
        name
        code
    }

    # Get translations for ACF Options Pages.
    # See the section in the README.
    siteSettings(language: EN) {
        siteSettings {
            footerTitle
        }
    }
}

Tags:

Misc Example