- סטטוס
- נפתר
- נפתר בגרסה
- 4.4.12
סקירה כללית של התקלה
במקרים מסוימים, ייתכן שתרגומי וידג’טים לא יוצגו בצד הלקוח של האתר, ותראה את השגיאה הבאה:
PHP Warning: array_merge(): Expected parameter 1 to be an array, null given in …\wp-content\plugins\sitepress-multilingual-cms\classes\widgets\class-wpml-widgets-support-frontend.php on line 61
פתרון עוקף
בעיה זו תתוקן בגרסה הבאה של WPML, אולם בינתיים תוכל להשתמש בפתרון העוקף הבא:
- לפני שתמשיך, צור גיבוי מלא של האתר שלך.
- עבור אל התיקייה /plugins/sitepress-multilingual-cms/classes/widgets/.
- פתח את הקובץ class-wpml-widgets-support-frontend.php והחלף את השורות 56-67:
private function it_must_display( $instance ) { if ( isset ( $instance['content'] ) ) { $matches = Str::matchAll( self::TERM_REGEX, $instance['content'] ); $matches = Fns::map( pipe( Lst::nth( 0 ), Json::toArray() ), $matches ); if ( count( $matches ) > 0 ) { $instance = array_merge(...$matches); } } return Lst::includes( Obj::propOr( null, 'wpml_language', $instance ), [ null, $this->current_language, 'all' ] ); } } - ב:
private function it_must_display( $instance ) { return ! array_key_exists( 'wpml_language', $instance ) || $instance['wpml_language'] === $this->current_language || 'all' === $instance['wpml_language']; } }