WPML
상태
해결됨
보고된 제품
WPML Multilingual CMS 4.6.13
해결된 버전
WPML 4.7.2
관련 플러그인/테마
Elementor
주제 태그
ATE, Compatibility

문제 개요

WPML의 고급 번역 에디터(ATE)를 사용하여 Elementor로 생성된 페이지를 번역할 때, <(작음) 또는 >(큼)와 같은 문자가 제거되거나 HTML 태그로 잘못 해석됩니다.

임시 해결 방법

진행하기 전에 전체 사이트 백업을 완료했는지 확인하세요.


  • …/wp-content/plugins/sitepress-multilingual-cms/classes/xliff/class-wpml-tm-xliff-writer.php 파일을 여세요.

  • 407번째 줄을 찾으세요.

  • 다음을:
    	private function remove_line_breaks_inside_tags( $string ) {
    		return preg_replace_callback( '/(<[^>]*>)/m', array( $this, 'remove_line_breaks_inside_tag_callback' ), $string );
    	}
    
    	/**
    	 * @param array $matches
    	 *
    	 * @return string
    	 */
    	private function remove_line_breaks_inside_tag_callback( array $matches ) {
    		$tag_string = preg_replace( '/([\nr\t ]+)/', ' ', $matches[0] );
    		$tag_string = preg_replace( '/(<[\s]+)/', '<', $tag_string );
    		return preg_replace( '/([\s]+>)/', '>', $tag_string );
    	}

  • 다음으로 변경하세요:
    	private function remove_line_breaks_inside_tags( $string ) {
    	    // Match only valid HTML tags (opening, closing, or self-closing)
    	    return preg_replace_callback( '/(<\/?[a-zA-Z][^<>]*>)/m', array( $this, 'remove_line_breaks_inside_tag_callback' ), $string );
    	}
    
    	/**
    	 * @param array $matches
    	 *
    	 * @return string
    	 */
    	private function remove_line_breaks_inside_tag_callback( array $matches ) {
    	    // Remove unnecessary spaces and line breaks inside valid HTML tags
    	    $tag_string = preg_replace( '/([\nr\t ]+)/', ' ', $matches[0] );
    	    $tag_string = preg_replace( '/(<[\s]+)/', '<', $tag_string );
    	 return preg_replace( '/([\s]+>)/', '>', $tag_string );
    	}

알려진 모든 문제 →