- สถานะ
- แก้ไขแล้ว
- แก้ไขใน
- WPML 4.7.6
- ปลั๊กอิน/ธีมที่เกี่ยวข้อง
- Elementor
- แท็กหัวข้อ
- Compatibility
ภาพรวมของปัญหา
ในส่วนการตั้งค่าขั้นสูงของวิดเจ็ต Elementor Pro คุณสามารถเพิ่มเงื่อนไขการแสดงผลได้ เช่น กำหนดให้แสดงวิดเจ็ตเฉพาะเมื่อผู้ใช้เข้าสู่ระบบแล้วเท่านั้น
เมื่อไม่นานมานี้มีการเปลี่ยนแปลงวิธีที่ Elementor จัดเก็บข้อมูลนี้ ซึ่งอาจทำให้เกิดข้อผิดพลาดต่อไปนี้:
PHP Fatal error: Uncaught TypeError: Cannot access offset of type string on string in .../wp-content/plugins/sitepress-multilingual-cms/addons/wpml-page-builders/classes/Integrations/Elementor/Hooks/DisplayConditions.php:138
วิธีแก้ปัญหาชั่วคราว
เราจะอัปเดตโค้ดของเราเพื่อรองรับการเปลี่ยนแปลงนี้ในการจัดเก็บข้อมูลของ Elementor ในระหว่างนี้ คุณสามารถแก้ไขไฟล์ปลั๊กอินนี้: wp-content/plugins/sitepress-multilingual-cms/addons/wpml-page-builders/classes/Integrations/Elementor/Hooks/DisplayConditions.php
ค้นหาฟังก์ชัน convertConditionIds (จากบรรทัดที่ 134 ในเวอร์ชันปัจจุบัน) และแทนที่ด้วยโค้ดด้านล่าง:
private function convertConditionIds( array $conditionGroups ) {
// ensure $conditionGroups is an array of arrays and not just an associative array
$result = array_keys($conditionGroups)[0] !== 0 ? array($conditionGroups) : $conditionGroups;
foreach ( $result as $key => $conditionGroup ) {
$configForCondition = $this->getConfigForCondition( $conditionGroup['condition'] );
if ( $configForCondition && isset( $conditionGroup[ $configForCondition['field'] ] ) ) {
$result[ $key ] = $this->convertIdsForCondition( $conditionGroup, $configForCondition );
}
}
return $result;
}