rburgst/wp-graphql-wpml

Impossible to fetch menuItems by locale

adriandmitroca opened this issue ยท 5 comments

Impossible to fetch menuItems by locale

this is correct, I am working on it but it will take more time as this is quite complex. In the meantime you can use https://github.com/rburgst/gatsby-source-wordpress-menus

Same applies to pages by the way.

via 8ba0b49 you can now get the language for each menu item. However, filtering by language is not yet supported unfortunately.

I'm getting the menuItems by language with the following query, but it is only working in GraphiQL and not in my Next.js app.

query PrimaryMenuByLocale($locale: String = "en") {
  menuItems(where: {location: MENU_1, language: $locale}, first: 100) {
    nodes {
      key: id
      parentId
      title: label
      url
      locations
      path
    }
  }
}

@retzion I fear you are correct. While the plugin already registers the corresponding filters I am fairly certain that filtering everything (especially menu items) by language does not yet work. This is unfortunately quite a tricky problem.
Also my main focus is to make the plugin work for gatsby queries (where you can do all the filtering on the gatsby graphql model).
I will try to make some time to get this working but dont hold your breath. If you want to contribute and make the plugin better, please let me know.