WPML
상태
해결됨
해결된 버전
1.2.0
관련 플러그인/테마
Yoast SEO

문제 개요

Yoast 14.x의 최근 주요 변경 사항 이후, 일부 WPML 사용자에게 Yoast 콘텐츠가 항상 기본 언어로 생성되고 있습니다.

예를 들어 보조 언어로 된 페이지에서 “og:title” 또는 “og:description”과 같은 “meta” 태그나 브레드크럼의 URL이 이에 해당할 수 있습니다.

임시 해결 방법이 있지만 문제의 특성상 모든 사용자에게 적용되지는 않을 수 있습니다. 이 문제를 가능한 한 빨리 해결하기 위해 작업 중입니다.

Yoast 콘텐츠 번역에 문제가 있는 경우, 지원 티켓을 생성하기 전에 아래의 임시 해결 방법을 시도하고 Yoast Multilingual의 다음 릴리스를 기다리세요.

임시 해결 방법

테마의 functions.php에 다음 코드를 추가하세요:

if ( ! is_admin() ) {
	add_filter( 'wpseo_title', 'wpml_wpseo_title', 10, 2 );
	add_filter( 'wpseo_opengraph_title', 'wpml_wpseo_title', 10, 2 );
}

function wpml_wpseo_title( $title, $presentation ) {
	switch ( $presentation->model->object_type ) {
		case 'post-type-archive':
			$key = 'title-ptarchive-' . $presentation->model->object_sub_type;
			break;
		case 'system-page':
			$key = 'title-' . $presentation->model->object_sub_type . '-wpseo';
			break;
		default:
			$key = false;
	}

	if ( $key ) {
		$option = get_option( 'wpseo_titles' );
		if ( isset( $option[ $key ] ) ) {
			$title = wpseo_replace_vars( $option[ $key ], $presentation );
		}
	}

	return $title;
}

if ( ! is_admin() ) {
	add_filter( 'wpseo_metadesc', 'wpml_wpseo_desc', 10, 2 );
	add_filter( 'wpseo_opengraph_desc', 'wpml_wpseo_desc', 10, 2 );
}

function wpml_wpseo_desc( $title, $presentation ) {
	switch ( $presentation->model->object_type ) {
		case 'post-type-archive':
			$key = 'metadesc-ptarchive-' . $presentation->model->object_sub_type;
			break;
		case 'system-page':
			$key = 'metadesc-' . $presentation->model->object_sub_type . '-wpseo';
			break;
		default:
			$key = false;
	}

	if ( $key ) {
		$option = get_option( 'wpseo_titles' );
		if ( isset( $option[ $key ] ) ) {
			$title = wpseo_replace_vars( $option[ $key ], $presentation );
		}
	}

	return $title;
}

add_filter( 'wpseo_save_indexable', function( $indexable ) {
		$args = [
			'element_id'   => $indexable->object_id,
			'element_type' => $indexable->object_type,
		];

		$language_code        = apply_filters( 'wpml_element_language_code', false, $args );
		$indexable->permalink = apply_filters( 'wpml_permalink', $indexable->permalink, $language_code, true );

		return $indexable;
} );

코드를 추가한 후 Yoast Test Helper 플러그인을 설치하세요.
도구 > Yoast Test로 이동하여 “Reset Indexables tables & migrations”를 클릭하세요.
마지막으로 대시보드로 이동하여 사이트 색인 생성을 요청하는 관리 화면 알림을 클릭하세요.

질문이 있거나 관련 문제를 보고하려면 저희 팀이 효율적인 지원을 제공할 수 있도록 이 알려진 문제를 언급해 주세요.

알려진 모든 문제 →