WPML
סטטוס
נפתר
נפתר בגרסה
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;
	}

כל התקלות הידועות →