문제 개요
WPGraphQL 확장 프로그램을 사용하는 경우, 이름과 같이 이미 번역된 작성자 메타데이터 콘텐츠에 대해 WPGraphQL 쿼리가 계속해서 기본 언어로 데이터를 반환하는 것을 알 수 있습니다.
임시 해결 방법
이 문제는 WPML GraphQL 1.1.3에서 해결되었습니다. 업데이트하면 사이트에서 문제가 해결되므로, 아직 업데이트할 수 없는 경우에만 이 임시 해결 방법이 필요합니다.
진행하기 전에 사이트의 전체 사이트 백업이 있는지 확인하세요.
- …/wp-content/plugins/wp-graphql/src/Model/User.php 파일을 여세요.
- 191번째 줄을 찾으세요.
- 다음 코드를:
'firstName' => function () { return ! empty( $this->data->first_name ) ? $this->data->first_name : null; }, - 다음 코드로 교체하세요:
'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; },