WPML
상태
해결됨
보고된 제품
WPML GraphQL 1.0.0
해결된 버전
WPML GraphQL 1.1.3
관련 플러그인/테마
WPGraphQL
주제 태그
Compatibility, Feature request

문제 개요

WPGraphQL 확장 프로그램을 사용하는 경우, 이름과 같이 이미 번역된 작성자 메타데이터 콘텐츠에 대해 WPGraphQL 쿼리가 계속해서 기본 언어로 데이터를 반환하는 것을 알 수 있습니다.

임시 해결 방법

진행하기 전에 사이트의 전체 사이트 백업이 있는지 확인하세요.


  • …/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;
    },

참고: 이 임시 해결 방법은 nicename, description 등과 같은 다른 문자열에도 확대 적용해야 할 수 있습니다.

알려진 모든 문제 →