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.
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 supporter: Europe/Zagreb (GMT+01:00)
Marqué : Exception
Ce sujet contient 2 réponses, a 0 voix.
Dernière mise à jour par Bruno Kos Il y a 3 jours et 13 heures.
Assisté par: Bruno Kos.
Auteur | Articles |
---|---|
février 12, 2025 à 10:29 am #16695587 | |
raduM-2 |
Contexte de la question: query Query { pages(where: {language: "all"}) { nodes { title languageCode postSelector { selection { nodes { slug uri } } } } } } I have this issue on a new WordPress install with all WPML/ACF/GraphQL plugins up to date. Symptômes: Questions: |
février 12, 2025 à 1:46 pm #16696934 | |
Bruno Kos Supporter
Les langues: Anglais (English ) Allemand (Deutsch ) Français (Français ) Fuseau horaire: Europe/Zagreb (GMT+01: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. 2. Check the translation preferences for the ACF Relationship field (`postSelector`) in WPML → Settings → Custom Fields Translation. Let me know what happens with both tests! |
février 13, 2025 à 7:19 am #16700149 | |
raduM-2 |
Hi Bruno, thank you for your response. 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. |
février 13, 2025 à 10:16 am #16701057 | |
Bruno Kos Supporter
Les langues: Anglais (English ) Allemand (Deutsch ) Français (Français ) Fuseau horaire: Europe/Zagreb (GMT+01:00) |
Can you please try the following: 1. Check the solution provided in this WPML forum thread: https://wpml.org/forums/topic/graphql-and-wpml/#post-16007191. It sounds similar so the workaround may work. 2. If the issue persists, would you be willing to provide WordPress credentials for further investigation? You can find details on privacy and security when sharing credentials here: https://wpml.org/purchase/support-policy/privacy-and-security-when-providing-debug-information-for-support/ Your next reply has been marked as private so you can safely add credentials. |
février 13, 2025 à 12:36 pm #16702055 | |
Bruno Kos Supporter
Les langues: Anglais (English ) Allemand (Deutsch ) Français (Français ) Fuseau horaire: Europe/Zagreb (GMT+01: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`. private function get_where_lang() { $lang = $this->sitepress->get_current_language(); if ( 'all' === $lang || function_exists('is_graphql_request') && is_graphql_request() ) { return ''; } else { $display_as_translated_snippet = $this->get_display_as_translated_snippet( $lang, $this->sitepress->get_default_language() ); return $this->wpdb->prepare( " AND ( icl_t.language_code = %s OR {$display_as_translated_snippet} ) ", $lang ); } } This modification ensures that when a GraphQL request is detected, the language filter does not interfere. Can you give it a try? |
février 13, 2025 à 1:55 pm #16702892 | |
raduM-2 |
No problem. I applied the workaround but it didn't fixed the issue, the 'selection' nodes array is still empty for French and Spanish languages. |
février 14, 2025 à 8:20 am #16705167 | |
Bruno Kos Supporter
Les langues: Anglais (English ) Allemand (Deutsch ) Français (Français ) Fuseau horaire: Europe/Zagreb (GMT+01:00) |
I am checking this with our 2nd tier and will keep you posted. |
février 17, 2025 à 6:11 am #16711673 | |
Bruno Kos Supporter
Les langues: Anglais (English ) Allemand (Deutsch ) Français (Français ) Fuseau horaire: Europe/Zagreb (GMT+01: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. You can find more information about the process here: Please confirm if this approach is acceptable to you! |
février 17, 2025 à 7:15 am #16711752 | |
raduM-2 |
Ok sounds good to me, you can go ahead ! |
février 17, 2025 à 12:02 pm #16713967 | |
Bruno Kos Supporter
Les langues: Anglais (English ) Allemand (Deutsch ) Français (Français ) Fuseau horaire: Europe/Zagreb (GMT+01: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. |
février 19, 2025 à 6:16 am #16721822 | |
Bruno Kos Supporter
Les langues: Anglais (English ) Allemand (Deutsch ) Français (Français ) Fuseau horaire: Europe/Zagreb (GMT+01: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**. add_filter('wpgraphql/acf/field_value', function($prepared_value, $acf_field, $node_id, $current_post) { if (!empty($prepared_value) && is_array($prepared_value) && isset($prepared_value[0])) { $type = get_post_type($current_post); $args = array('element_id' => $current_post, 'element_type' => $type ); $my_language_code = apply_filters( 'wpml_element_language_details', null, $args ); $prepared_value[0] = apply_filters('wpml_object_id', $prepared_value[0], 'post', true , $my_language_code->language_code); do_action( 'wpml_switch_language', $my_language_code->language_code ); } return $prepared_value; }, 10, 5); This should ensure the relationship field is correctly processed. We also created an internal ticket where this will be fixed permanently. |