WPML
Trạng thái
Đã giải quyết
Đã giải quyết trong
WPML 4.7.6
Plugin/giao diện liên quan
Elementor
Thẻ chủ đề
Compatibility

Tổng quan về lỗi

Với các cài đặt nâng cao của widget trong Elementor Pro, bạn có thể thêm Điều kiện hiển thị, ví dụ như chỉ hiển thị một widget nếu người dùng đã đăng nhập.

Gần đây, đã có thay đổi về cách Elementor lưu trữ dữ liệu này và nó có thể gây ra lỗi sau:

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

Giải pháp tạm thời

Chúng tôi sẽ cập nhật mã của mình để xử lý thay đổi này trong việc lưu trữ dữ liệu của Elementor. Trong lúc chờ đợi, bạn có thể chỉnh sửa tệp plugin này: wp-content/plugins/sitepress-multilingual-cms/addons/wpml-page-builders/classes/Integrations/Elementor/Hooks/DisplayConditions.php

Tìm hàm convertConditionIds (từ dòng 134 trong phiên bản hiện tại) và thay thế bằng mã dưới đây:

	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;
	}

Tất cả các lỗi đã ghi nhận →