문제 개요
Yoast SEO를 사용할 때 플러그인은 작성자 아카이브 페이지의 head 섹션에 Open Graph 메타 태그를 자동으로 추가합니다. 하지만 번역된 작성자 아카이브 페이지에서는 og:url 메타 태그가 기본 언어의 URL을 표시합니다.
임시 해결 방법
이 문제는 해결되었습니다. 최신 버전으로 업데이트하면 사이트에서 이 문제가 해결되므로, 아직 업데이트할 수 없는 경우에만 이 임시 해결 방법이 필요합니다.
진행하기 전에 사이트의 전체 백업을 완료했는지 확인하세요.
- 테마의 functions.php 파일을 여세요.PHP
/** * Workaround to fix og:url meta tag on translations of author archives */ add_filter( 'wpseo_opengraph_url', function($url, $presentation){ if ( $presentation instanceof YoastWPSEOPresentationsIndexable_Author_Archive_Presentation ){ $user_id = $presentation->source['post_author']; $url = rawurlencode( get_author_posts_url($user_id) ); } return $url; }, 10, 2 );