문제 개요
상품 고유주소를 상점 기준 및 카테고리로 설정한 상태에서 WPML Multilingual & Multicurrency for WooCommerce를 사용할 때 ERR_TOO_MANY_REDIRECTS 오류가 발생할 수 있습니다.
이 문제는 상품이 번역 가능 – 번역이 있으면 사용하고 없으면 기본 언어로 대체로 설정되어 있고 상품 카테고리도 번역 가능한 경우에 발생합니다. 보조 언어로 전환할 때 번역된 상품 URL이 올바르게 처리되지 않아 무한 리디렉션 루프가 발생합니다.
임시 해결 방법
이 문제는 WPML Multilingual & Multicurrency for WooCommerce 5.5.3에서 해결되었습니다. 업데이트하면 사이트에서 문제가 해결되므로, 아직 업데이트할 수 없는 경우에만 이 임시 해결 방법이 필요합니다.
계속하기 전에 사이트의 전체 백업이 준비되어 있는지 확인하세요.
- 테마의 function.php 파일을 여세요.
- 다음 코드를 추가하세요:
add_filter( 'wc_product_post_type_link_product_cat', 'custom_modify_product_cat', 10, 3 ); function custom_modify_product_cat( $primary_term, $terms, $post ) { // Example: Replace the primary term if the product has a specific category if ( $post->post_type === 'product' ) { foreach ( $terms as $term ) { $termid = apply_filters( 'wpml_object_id', $term->term_id, $term->taxonomy, TRUE ); $term = get_term( $termid, $term->taxonomy ); return $term; } } return $primary_term; }