- สถานะ
- แก้ไขแล้ว
- รายงานสำหรับ
- WPML Multilingual CMS 4.6.13
- แก้ไขใน
- WPML 4.7.2
- ปลั๊กอิน/ธีมที่เกี่ยวข้อง
- Elementor
- แท็กหัวข้อ
- ATE, Compatibility
ภาพรวมของปัญหา
เมื่อแปลหน้าที่สร้างด้วย Elementor โดยใช้ ตัวแก้ไขการแปลขั้นสูง (ATE) ของ WPML อักขระอย่างเช่น < (น้อยกว่า) หรือ > (มากกว่า) จะถูกตัดออกหรือถูกตีความผิดว่าเป็นแท็ก HTML
วิธีแก้ปัญหาชั่วคราว
โปรดตรวจสอบให้แน่ใจว่าคุณมีการสำรองข้อมูลไซต์ทั้งหมดก่อนดำเนินการต่อ
- เปิดไฟล์ …/wp-content/plugins/sitepress-multilingual-cms/classes/xliff/class-wpml-tm-xliff-writer.php
- ค้นหาบรรทัดที่ 407
- แทนที่:
private function remove_line_breaks_inside_tags( $string ) { return preg_replace_callback( '/(<[^>]*>)/m', array( $this, 'remove_line_breaks_inside_tag_callback' ), $string ); } /** * @param array $matches * * @return string */ private function remove_line_breaks_inside_tag_callback( array $matches ) { $tag_string = preg_replace( '/([\nr\t ]+)/', ' ', $matches[0] ); $tag_string = preg_replace( '/(<[\s]+)/', '<', $tag_string ); return preg_replace( '/([\s]+>)/', '>', $tag_string ); } - ด้วย:
private function remove_line_breaks_inside_tags( $string ) { // Match only valid HTML tags (opening, closing, or self-closing) return preg_replace_callback( '/(<\/?[a-zA-Z][^<>]*>)/m', array( $this, 'remove_line_breaks_inside_tag_callback' ), $string ); } /** * @param array $matches * * @return string */ private function remove_line_breaks_inside_tag_callback( array $matches ) { // Remove unnecessary spaces and line breaks inside valid HTML tags $tag_string = preg_replace( '/([\nr\t ]+)/', ' ', $matches[0] ); $tag_string = preg_replace( '/(<[\s]+)/', '<', $tag_string ); return preg_replace( '/([\s]+>)/', '>', $tag_string ); }