Title: Data always fetch for same language without checking the language parameter
Last modified: June 26, 2024

---

# Data always fetch for same language without checking the language parameter

 *  Resolved [priteshsaxena31](https://wordpress.org/support/users/priteshsaxena31/)
 * (@priteshsaxena31)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/data-always-fetch-for-same-language-without-checking-the-language-parameter/)
 * Hello Team
 * I have created a translated website using GraphQL and WPML.
 * I have created a custom post type with a custom taxonomy and translated that 
   in french language.
 * So when i fetched the posts based on taxonomy in GraphQL IDE it fetches the same
   language posts in both the posts weather it is English or french.
 * What i want is if i select the english taxonomy it needs to fetch english posts
   and if i select french taxonomy it needs to fetch french posts.
 * Can you provide a solution as to why this is happening?

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Thread Starter [priteshsaxena31](https://wordpress.org/support/users/priteshsaxena31/)
 * (@priteshsaxena31)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/data-always-fetch-for-same-language-without-checking-the-language-parameter/#post-17851037)
 * I have checked the database it saves correct value for english and french
 * Query are :
 *     ```wp-block-code
       english query :query NewQuery {city(id: "dGVybToxNDM=", idType: ID) {idsluglanguageCodetranslations {id}models {edges {node {sluglanguageCodedatabaseId}}}posts {edges {node {idlanguageCode}}}}}result of english query :{"data": {"city": {"id": "dGVybToxNDM=","slug": "belgium","languageCode": "en","translations": [{"id": "dGVybTo4NjI2"}],"models": {"edges": [{"node": {"slug": "phaedra","languageCode": "en","databaseId": 59387}},{"node": {"slug": "valentina","languageCode": "en","databaseId": 59282}},{"node": {"slug": "caroline","languageCode": "en","databaseId": 58213}},{"node": {"slug": "angelina","languageCode": "en","databaseId": 58052}},{"node": {"slug": "emily","languageCode": "en","databaseId": 57712}},{"node": {"slug": "lisa","languageCode": "en","databaseId": 57502}},{"node": {"slug": "julia","languageCode": "en","databaseId": 55700}},{"node": {"slug": "isabelle","languageCode": "en","databaseId": 5742}},{"node": {"slug": "iris","languageCode": "en","databaseId": 3151}},{"node": {"slug": "alice","languageCode": "en","databaseId": 233}}]},"posts": {"edges": [{"node": {"id": "cG9zdDo1ODU4NQ==","languageCode": "en"}},{"node": {"id": "cG9zdDo1ODM4OQ==","languageCode": "en"}},{"node": {"id": "cG9zdDo1NzgwOA==","languageCode": "en"}},{"node": {"id": "cG9zdDo1MjYy","languageCode": "en"}}]}}}}french query :query NewQuery {city(id: "dGVybTo4NjI2", idType: ID) {idsluglanguageCodetranslations {id}models {edges {node {sluglanguageCodedatabaseId}}}posts {edges {node {idlanguageCode}}}}}result of french query:{"data": {"city": {"id": "dGVybTo4NjI2","slug": "belgium-fr","languageCode": "fr","translations": [{"id": "dGVybToxNDM="}],"models": {"edges": [{"node": {"slug": "phaedra","languageCode": "en","databaseId": 59387}},{"node": {"slug": "valentina","languageCode": "en","databaseId": 59282}},{"node": {"slug": "caroline","languageCode": "en","databaseId": 58213}},{"node": {"slug": "angelina","languageCode": "en","databaseId": 58052}},{"node": {"slug": "emily","languageCode": "en","databaseId": 57712}},{"node": {"slug": "lisa","languageCode": "en","databaseId": 57502}},{"node": {"slug": "julia","languageCode": "en","databaseId": 55700}},{"node": {"slug": "isabelle","languageCode": "en","databaseId": 5742}},{"node": {"slug": "iris","languageCode": "en","databaseId": 3151}},{"node": {"slug": "alice","languageCode": "en","databaseId": 233}}]},"posts": {"edges": [{"node": {"id": "cG9zdDo1ODU4NQ==","languageCode": "en"}},{"node": {"id": "cG9zdDo1ODM4OQ==","languageCode": "en"}},{"node": {"id": "cG9zdDo1NzgwOA==","languageCode": "en"}},{"node": {"id": "cG9zdDo1MjYy","languageCode": "en"}}]}}},}
       ```
   
 * As you can see it gives same result
 *  Plugin Author [Jason Bahl](https://wordpress.org/support/users/jasonbahl/)
 * (@jasonbahl)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/data-always-fetch-for-same-language-without-checking-the-language-parameter/#post-17852024)
 * [@priteshsaxena31](https://wordpress.org/support/users/priteshsaxena31/) you 
   shared 2 queries and indicated that one is the french query and one is the english
   query. Neither of them indicate the language.
 * Out of the box, WPGraphQL doesn’t work with WPML so you need an extension such
   as: 
   – [https://github.com/rburgst/wp-graphql-wpml](https://github.com/rburgst/wp-graphql-wpml)
   or – [https://wpml.org/documentation/related-projects/wpml-graphql/](https://wpml.org/documentation/related-projects/wpml-graphql/)
   Both of these plugins add “language” arguments to the fields in GraphQL so you
   can query for fields in a specific language. For example, the WPML-GraphQL extension
   on wpml.org shows a query like so:
 *     ```wp-block-code
       {  posts( where: { language: all } ) {    nodes { ... }  }}
       ```
   
 * In order to get content of a specific language, you will need to specify what
   language you are asking for content in. 
   I would refer to the relevant extension(
   s) documentation to understand how to accomplish what you’re after.
 *  Thread Starter [priteshsaxena31](https://wordpress.org/support/users/priteshsaxena31/)
 * (@priteshsaxena31)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/data-always-fetch-for-same-language-without-checking-the-language-parameter/#post-17853415)
 * Hello [@jasonbahl](https://wordpress.org/support/users/jasonbahl/) Thanks for
   your response 
   For the queries it will be sorted out by id parameter as you can
   see the id is different in both the queries.
 * city(id: “dGVybToxNDM=”) this is English post id
 * city(id: “dGVybTo4NjI2”) this is french post id
 * Some of the queries is working fine for posts but when i select english or french
   in this post type i have created a custom post type and a custom taxonomy when
   i fetch the posts based on taxonomy it gives same result which i have posted 
   here.
 * When i check the database the data is correctly saved.
 * So what i thought is there is an issue when i fetch data using graphQL. Can you
   suggest something.
 *  Plugin Support [Joe Fusco](https://wordpress.org/support/users/joefusco/)
 * (@joefusco)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/data-always-fetch-for-same-language-without-checking-the-language-parameter/#post-17856571)
 * Hey [@priteshsaxena31](https://wordpress.org/support/users/priteshsaxena31/),
   the 2 plugins suggested above might be worth exploring.
   I’m going to mark this
   as resolved as this has to do with WPML specifically and there are community 
   solutions available. We appreciate your feedback!

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Data always fetch for same language without checking the language parameter’
is closed to new replies.

 * ![](https://ps.w.org/wp-graphql/assets/icon-256x256.png?rev=3111985)
 * [WPGraphQL](https://wordpress.org/plugins/wp-graphql/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-graphql/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-graphql/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-graphql/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-graphql/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-graphql/reviews/)

## Tags

 * [graphql](https://wordpress.org/support/topic-tag/graphql/)

 * 4 replies
 * 3 participants
 * Last reply from: [Joe Fusco](https://wordpress.org/support/users/joefusco/)
 * Last activity: [1 year, 10 months ago](https://wordpress.org/support/topic/data-always-fetch-for-same-language-without-checking-the-language-parameter/#post-17856571)
 * Status: resolved