- 상태
- 개발자 대기 중
- 관련 플러그인/테마
- Yoast SEO
- 주제 태그
- Compatibility
문제 개요
상품 > 카테고리에서 제품 카테고리 번역을 수동으로 편집할 때, (슬러그가 아닌) 카테고리 설명/텍스트만 변경된 경우에도 Yoast SEO Premium이 301 리디렉션을 잘못 생성했습니다.
생성된 리디렉션의 URL 형식이 잘못되었습니다:
이전 URL: http://site.com/product-category/test-es-wpml
새 URL: http://site.com/http://es.site.com/product-category/test-es-wpml/ (이중 URL!)
참고: 이는 시각적인 오류이며, 이 리디렉션은 네비게이션 문제를 일으키지 않습니다
임시 해결 방법
진행하기 전에 전체 사이트 백업을 완료했는지 확인하세요.
- …/wp-content/plugins/wordpress-seo-premium/classes/term-watcher.php 파일을 여세요.
- “protected function get_target_url(” 함수를 찾으세요. 241번째 줄 근처에 있습니다.
- 다음 코드를:
protected function get_target_url( $tag, $taxonomy ) { // Get the term link. $term_link = get_term_link( $tag, $taxonomy ); // Return early if the term link is not a string, i.e. a WP_Error Object. if ( ! is_string( $term_link ) ) { return ''; } return str_replace( home_url(), '', $term_link ); }
- 다음으로 변경하세요:
protected function get_target_url( $tag, $taxonomy ) { // Get the term link. $term_link = get_term_link( $tag, $taxonomy ); // Return early if the term link is not a string, i.e. a WP_Error Object. if ( ! is_string( $term_link ) ) { return ''; } // Extract the path to handle WPML subdomain URLs (matches post-watcher behavior). $url = wp_parse_url( $term_link ); if ( is_array( $url ) && isset( $url['path'] ) ) { return $url['path']; } return ''; }