ภาพรวมของปัญหา
คุณอาจพบปัญหาที่หน้าเว็บไม่ถูกทำเครื่องหมายว่าแปลแล้วหลังจากทำการแปลเสร็จสมบูรณ์ 100% เมื่อใช้ WPML ร่วมกับ ธีม Divi นอกจากนี้ อาจมีการบันทึกข้อผิดพลาดต่อไปนี้:
PHP Fatal error: Uncaught TypeError: htmlspecialchars_decode(): Argument #1 ($string) must be of type string, array given in .../wp-content/plugins/sitepress-multilingual-cms/addons/wpml-page-builders/classes/Shared/st/strategy/shortcode/class-wpml-pb-update-shortcodes-in-content.php:203
วิธีแก้ปัญหาชั่วคราว
ปัญหานี้ได้รับการแก้ไขแล้วใน WPML 4.7 การอัปเดตจะแก้ปัญหานี้บนไซต์ของคุณ ดังนั้นคุณจึงต้องใช้วิธีแก้ปัญหาชั่วคราวนี้เฉพาะเมื่อคุณยังไม่สามารถอัปเดตได้
โปรดตรวจสอบให้แน่ใจว่าคุณมีข้อมูลสำรองไซต์แบบเต็มของไซต์คุณก่อนดำเนินการต่อ
- เปิดไฟล์ …/wp-content/plugins/sitepress-multilingual-cms/addons/wpml-page-builders/classes/Shared/st/strategy/shortcode/class-wpml-pb-update-shortcodes-in-content.php
- ค้นหาบรรทัดที่ 206
- แทนที่:
if ( 'allow_html_tags' !== $encoding ) { $translation = htmlspecialchars( htmlspecialchars_decode( $translation ) ); } - ด้วย:
// Ensure $translation is a string if (is_array($translation)) { // Handle array to string conversion as needed $translation = implode('', $translation); } if ( 'allow_html_tags' !== $encoding ) { $translation = htmlspecialchars( htmlspecialchars_decode( $translation ) ); }