- 상태
- 미해결
- 보고된 제품
- WPML Multilingual CMS 4.6.13
- 주제 태그
- Bug
문제 개요
사용자 정의 글 유형과 택소노미가 동일한 슬러그를 공유할 때 WYSIWYG 필드에서 상대 링크가 잘못 표시되는 알려진 문제가 있습니다. 이로 인해 링크가 프런트엔드에서 쿼리 문자열 형식으로 되돌아가며, 예상된 예쁜 고유주소 구조에서 벗어나게 됩니다.
예를 들어, http://domain/test/post-type/test-cpt/ 주소로 연결되어야 하는 링크가 대신 http://domain/?taxonomy-test-post-type=test-cpt 주소를 가리킵니다.
임시 해결 방법
functions.php 파일에 이 스니펫을 추가할 수 있습니다:
/**
* Temporary snippet: Replaces relative links with absolute links
* before it get converted by the filter `wpml_translate_link_targets`.
*/
add_filter( 'wpml_translate_link_targets', function( $value ) {
return preg_replace_callback( '/href="([^"]+)"/i', function( $matches ) {
if ( false === strpos( $matches[1], '://' ) ) {
$url = site_url( $matches[1] );
} else {
$url = $matches[1];
}
return 'href="' . $url . '"';
}, $value );
}, 0 );