Accueil›Assistance›Assistance en français›[Transmis à l'équipe des développeurs WPML] WPML GraphQL with ACF - Relationial fields doesn't returns data on non-default language
[Transmis à l'équipe des développeurs WPML] WPML GraphQL with ACF - Relationial fields doesn't returns data on non-default language
Il s'agit du forum d'assistance technique de WPML, le plug-in multilingue pour WordPress.
Il est accessible à tous, toutefois seuls les clients de WPML peuvent y publier leurs messages. L'équipe du WPML répond sur le forum 6 jours par semaine, 22 heures par jour.
Bonjour & bienvenue sur le forum de soutien WPML.
En raison des vacances, le forum français est fermé du 17 à 24 juin
D'ici là, veuillez vous adresser à notre support en anglais. Nous vous remercions pour votre compréhension et de votre patience.
Équipe de soutien WPML,
Sun
Mon
Tue
Wed
Thu
Fri
Sat
-
8:00 – 13:00
9:00 – 13:00
9:00 – 13:00
8:00 – 12:00
8:00 – 12:00
-
-
14:00 – 17:00
14:00 – 18:00
14:00 – 18:00
13:00 – 17:00
13:00 – 17:00
-
Fuseau horaire du support : Europe/Zagreb (GMT+02:00)
Contexte de la question:
I'm using WPGraphQL with WPML and ACF. I set three languages: English (default), French, and Spanish. I created a Relationship field with ACF to select posts, then created a Sample Page, populated the field with a Post, and translated it into the two languages. When querying this field with GraphQL IDE, only the page in the default language (English) returns the data. Other languages return an empty array. Here's the GraphQL query:
I have this issue on a new WordPress install with all WPML/ACF/GraphQL plugins up to date.
Symptômes:
When querying the Relationship field with GraphQL, only the default language (English) returns data. French and Spanish return an empty array.
Questions:
Why does the Relationship field return an empty array for non-default languages?
How can I get the same results for all languages using WPGraphQL with WPML and ACF?
Les langues: Anglais (English )Allemand (Deutsch )Français (Français )
Fuseau horaire: Europe/Zagreb (GMT+02:00)
Hi,
Can you try two things to help us troubleshoot the issue?
1. Add a simple ACF text field (e.g., `testField`) to the same pages and enter some test values in English, French, and Spanish. Then, check if the GraphQL query returns this new field for all languages.
1. I added a simple ACF text field and it's correctly returned in all languages by my GraphQL query.
2. The fields were already set to 'Translate'. I even tried to put them on 'Copy' and then put them back on 'Translate', while saving between each change but it didn't solve the issue.
Also, when fields were set to 'Copy', only the text fields were copied, the Relationship fields called 'selection' remained empty.
Les langues: Anglais (English )Allemand (Deutsch )Français (Français )
Fuseau horaire: Europe/Zagreb (GMT+02:00)
I apologize for this.
Here is that workaround:
1. Go to `\WPML_Term_Clauses::get_where_lang` in `wp-content/plugins/sitepress-multilingual-cms/classes/query-filtering/class-wpml-term-clauses.php`.
2. Replace the existing function with the following:
Les langues: Anglais (English )Allemand (Deutsch )Français (Français )
Fuseau horaire: Europe/Zagreb (GMT+02:00)
We think this to be a missing feature.
To troubleshoot this problem, I'll install the Duplicator plugin and generate packages for further debugging purposes. I'll ensure to exclude all media files to maintain a minimal package size.
Les langues: Anglais (English )Allemand (Deutsch )Français (Français )
Fuseau horaire: Europe/Zagreb (GMT+02:00)
This has been escalated to our 2nd tier team team and may take some debugging time, I'll get back to you as soon as I have any news or questions for you.
Les langues: Anglais (English )Allemand (Deutsch )Français (Français )
Fuseau horaire: Europe/Zagreb (GMT+02:00)
Can you please try the following:
1. Ensure the **relationship field** is set to **copy** as the value in **postmeta** should be **1:1 identical**.
2. Add the following code to your **functions.php** file: