- 상태
- 해결됨
- 해결된 버전
- 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']; } }