wp-graphql-wpml icon indicating copy to clipboard operation
wp-graphql-wpml copied to clipboard

Looking up a node by nodeByUri for a translated permalink

Open williamjulianvicary opened this issue 1 year ago • 4 comments

We have hit an issue where some of our custom post types have translated permalinks/slugs, an example query is below, the URI being passed is the relative path on the current page (i.e ///).

Example that works (non-translated):

  • /pagetype/pageslug

Examples that do not work:

  • /pagetypetranslated/pageslugtranslated
  • /locale/pagetypetranslated/pageslugtranslated
  • https://example.com/locale/pagetypetranslated/pageslugtranslated
  • pageslugtranslated
  • etc

It's as if the WPGraphQL plugin is not aware of any translated URIs on any custom post types. It DOES work for translated page URIs but not for any custom post types.

I've looked through open issues but can't see anything that stands out currently but possibly some related issues - does anyone have any clever ideas of how we can query these pages? We're using FaustJS and it has a seed query which it uses to resolve the correct template and appropriate document ID for the given URI so at present this is a bit of a blocker!

GraphQL to reproduce (pass in a URI):

query MyQuery($uri: String!) {
  node: nodeByUri(uri: $uri) {
    ...NodeByUri
  }
}

fragment NodeByUri on UniformResourceIdentifiable {
  __typename
  uri
  id
}

williamjulianvicary avatar May 15 '23 21:05 williamjulianvicary