- 상태
- 미해결
- 보고된 제품
- WPML Multilingual & Multicurrency for WooCommerce 5.3.9
- 주제 태그
- Bug, WCML
문제 개요
WPML Multilingual & Multicurrency for WooCommerce는 단일 상품 페이지의 리뷰 탭에 표시되는 상품 리뷰를 올바르게 번역합니다. 하지만 WooCommerce의 리뷰 블록을 사용할 때는 번역된 리뷰가 표시되지 않습니다. 대신 원본 언어 리뷰가 표시됩니다.
임시 해결 방법
진행하기 전에 전체 사이트 백업을 완료했는지 확인하세요.
- 테마의 functions.php 파일을 여세요.
- 다음 스니펫을 추가하세요:
add_filter( 'get_comment', 'translate_comment' ); function translate_comment( $comment ){ if ( !is_singular('product') && isset( $comment->comment_type ) && $comment->comment_type === 'review' && isset( $comment->comment_content ) ) { $name = 'product-'.$comment->comment_post_ID.'-review-'.$comment->comment_ID; $comment->comment_content = apply_filters( 'wpml_translate_single_string', $comment->comment_content, 'wcml-reviews', $name ); } return $comment; }