WPML
สถานะ
เปิด
รายงานสำหรับ
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;
    }

ปัญหาที่ทราบแล้วทั้งหมด →