- Stato
- Risolto
- Segnalato per
- WPML GraphQL 1.0.0
- Risolto in
- WPML GraphQL 1.1.3
- Plugin/tema correlato
- WPGraphQL
- Tag dell’argomento
- Compatibility, Feature request
Panoramica del problema
Se stai utilizzando l’estensione WPGraphQL, noterai che per i contenuti già tradotti dei metadati dell’autore, come i nomi, le query di WPGraphQL continuano a restituire i dati nella lingua predefinita.
Soluzione alternativa
Assicurati di avere un backup completo del tuo sito prima di procedere.
- Apri il file …/wp-content/plugins/wp-graphql/src/Model/User.php.
- Cerca la riga 191.
- Sostituisci:
'firstName' => function () { return ! empty( $this->data->first_name ) ? $this->data->first_name : null; }, - Con:
'firstName' => function () { // WPML Workaround for compsupp-7323 if ( class_exists('SitePress') ) { $post_language_details = apply_filters( 'wpml_post_language_details', NULL, $this->global_post->ID ) ; $this->data->first_name = apply_filters('wpml_translate_single_string', $this->data->first_name , 'Authors', 'first_name_'.$this->data->ID); } return ! empty( $this->data->first_name ) ? $this->data->first_name : null; },