WPML
סטטוס
נפתר
נפתר בגרסה
1.2.0
תוסף/ערכת עיצוב קשורים
Yoast SEO

סקירה כללית של התקלה

לאחר שינויים משמעותיים אחרונים ב־Yoast 14.x, חלק ממשתמשי WPML רואים שתוכן של Yoast נוצר תמיד בשפת ברירת המחדל.

לדוגמה, בעמוד בשפה משנית, אלו יכולות להיות תגיות “meta” כמו “og:title” או “og:description”, או כתובות ה־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”.
לבסוף, עבור אל לוח הבקרה שלך ולחץ על הודעת המערכת שמבקשת ממך לאנדקס את האתר.

אם יש לך שאלות או שברצונך לדווח על בעיה קשורה, אנא ציין תקלה ידועה זו כדי שהצוות שלנו יוכל לספק לך תמיכה יעילה.

כל התקלות הידועות →