Skip Navigation

Resolved

Resolved in: 1.2.0

Overview of the issue

After recent major changes in Yoast 14.x, some WPML users are seeing Yoast content always being generated in the default language.

For example, on a page in a secondary language, this could be “meta” tags like “og:title” or “og:description”, or the URLs in your breadcrumbs.

We have a workaround but due to the nature of the problem, it may not work for everyone. We are working to fix this issue as soon as possible.

If you are experiencing trouble translating Yoast content, please try the workaround below and wait for the next release of Yoast Multilingual before creating a support ticket.

Workaround

Add to your theme functions.php this code:

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;
} );

After adding the code, install the Yoast Test Helper plugin.
Go to Tools > Yoast Test and click in “Reset Indexables tables & migrations”.
Finally, go to your Dashboard and click on the admin notice that prompts you to index the site.

If you have any questions or wish to report a related problem, please do mention this known issue so that our team can provide you with efficient support.

16 Responses to “Some Yoast Content Is Always Generated In The Default Language”

  1. Right now it seems there are 2 ways of fixing this issue. Reverting Yoast Seo back to version 13.5 (the latest 13) or using your workaround (though I didn’t tested it yet). The question for me: is this issue on WPML’s side and will be fixed in the next release or is this only fixable if Yoast is going to fix their code?

    Though workarounds are nice to have as long there are no other ways to fix issues but you have to remember such code you implemented and remove it later when the issue is really fixed in future releases.

    • I obviously agree about your comment related to workarounds – the errata that are marked as ‘Bugs’ are added to our development boards and will be fixed depending on priorities – this one is already assigned and when there’s a fix I’ll mark it as resolved so you will be notified.

      • I want to add to this, that also canonical URLs are not working in such cases. The canonical of translations is pointing to the original version.

        Unfortunately, this workaround did not work on my staging system.

          • Hi Amit

            Thanks for your reply!

            For me (maybe interesting for others as well) the following workaround did the trick:

            When updating to newest yoast version, do not click on the button “index automatically” which is shown on top of every site in admincp.

            If already clicked, download the “yoast helper” plugin and delete the “indexables” table in yoast helper plugin.

            After that, the “indexables” will be generated correctly and automatically when users visit the website.

  2. I have the same problem and I share Karsten’s opinion, because once the code has been pasted in funtions.php, open it and remove it once the problem with the updates is corrected.

    However, I have not tested the code, I will do it today, because I have a problem with one of my clients. Once you migrated, you were left with the breadcrumb urls of the developing domain.

  3. We have this problem as well.

    Going back to a previous version of Yoast seems to create damage. We also tried your “workaround” above, but it caused many other problems in the Astra/WPPortfolio couple we use with things that disappear (and therefore are no longer accessible like custom layouts) in the backoffice.

    There is a thread on this WPML / YOAST incompatibility issue on the following link:
    https://wpml.org/forums/topic/custom-post-type-archive-breadcrumbs-in-yoast-seo-is-not-translating/

    I invite you to leave a note if you encounter the problem, in order to get things moving a little faster.

    We hope that this will be resolved soon, as the problem is really annoying. Do you have a timeline for resolving this bug. Our client is getting impatient.

    Thank you in advance.

    • We are in the final stages of testing, I hope it’ll be released in the next few days, we have also updated the above errata with a snippet that should fix the issue as a workaround.

      • Any update? Same issue for me. Yoast breadcrumb items for custom post types are not trnslated. Workaround does not work. Translation created for first visited language and shown in all languages in that language then.

          • Hello,
            We have updated the “Yoast SEO Multilingual” extension from 1.1 to 1.2
            The problem is partially fixed but there are still many issues.

            What has been fixed :
            – the tags description / og:description / og:title are well translated
            – yoast breadcrumb texts are also correctly translated

            On the other hand, we still have:
            – In the archives (wp portfolio archive as far as we’re concerned), the og:url tag which is not translated and which in English refers to the French page
            – In the yoast breadcrumb, links pointing to the archive page are not translated and therefore lead to 404 errors.

            We look forward to Update 1.3 so that we can complete our project. Looking forward to your response we wish you a good weekend. Thank you for keeping us informed.

            GBF Communication

            • Hello there,

              I apologize for the late reply.
              Thank you for bringing up this situation, however we have release a new version since your comment and these situations should have been already solved.

              If that is not the case, please open a support ticket in our forum so we can check it better:
              https://wpml.org/forums/forum/english-support/

  4. The Workaround doesn’t work for me. The catégory name and the url in the breadcrumb are not translated after saving or a modification of a post.
    Anyone have trying to came back in a previous version of yoast ?

  5. I tried this fix. It seems that description and title metatags are showing correctly. But the problem persists with breadcrumbs generated by Yoast. The same breadcrumbs appear for every language. I updated all WPML plugins as available today. I hope you can solve this soon.