Skip to main content
Search Engine OptimisationWordPress

Solution to Make Yoast SEO work with qTranslate-X

By 13th May 2019December 15th, 20205 Comments
Yoast SEO and qTranslate-X

You must be searching everywhere for Yoast SEO to work with qTranslate-X. We were once in your shoes and we had difficulties finding the solution ourselves until we found a workaround it. Before we begin, we need to know the root of the problems before we can find the solution to it, so let’s dig into the problems.

Problem 1: Yoast SEO have stopped working with qTranslate-X

According to Yoast SEO, they no longer work with qTranslate-X plugin because it is no longer updated or maintained in WordPress, which may affect the compatibility of the future version of Yoast SEO. Their recommendation is to use an alternate translation plugin that is available but that would require you to translate your entire website again, which is not ideal. But don’t worry, we found a workaround it without the use of any plugin or tweaking to your website codes.

Problem 2: Change either SEO or Translation plugin

While searching for a solution ourselves, and when we couldn’t find any, we were thinking that we may need to change either one of our plugins, so we have to decide between the pros and cons.

Change Yoast SEO plugin

If you were to change Yoast SEO plugin, the alternative plugin for it will be All in One SEO Pack. This plugin is a powerful as Yoast SEO but the downside is that you would need to re-do all your SEO effort. And if you have done years of SEO using Yoast SEO, then it is not ideal to waste all the years of effort.

Change qTranslate-X plugin

I bet you wouldn’t notice this as a problem when you were translating your website. Imaging only to realize that your SEO can’t work with qTranslate after you have spent weeks on translating your website. This can be a painful process to start your translation from scratch. This can be a painful process for your team or even yourself.

There is a plugin by qTranslate-X which can help you to integrate both Yoast SEO and qTranslate-X. We have personally tried this plugin but it doesn’t seem to work with the latest version of Yoast SEO. There are also a substantial amount of WordPress users who have issues using this integration plugin, so we better not use this as an option to our solution.

But in any case you really want to use this plugin (again…it is not recommended as we got a better solution for you), you have to downgrade your Yoast SEO plugin but that will just mean that you won’t have the latest Yoast SEO functionalities.

Solution: Finally, the moment is here...

Did you know that qTranslate & qTranslate-X support shortcodes which you can use for Yoast SEO? And you don’t even have to create these shortcodes as it has been created for you by default when you install qTranslate-X.

You do need to know where to get the language code. In our example, we will be using 2 languages (English and Bahasa Indonesia).

Firstly, you need to know where to get these codes. On your WordPress panel, navigate to Settings > Languages. Go to the Language tab.

qTranslate-X Language Tab

Now that you know each language code, you can go to the individual pages where you want to amend the translation for Yoast SEO. Let’s do an example for the meta title, which you can simply use this format below:

For English

[:en]Solution to Make Yoast SEO work with qTranslate-X

For Bahasa Indonesia

[:id]Solusi untuk Membuat Yoast SEO bekerjasama dengan qTranslate-X

With the 2 languages combined, Yoast SEO is likely to tell you that you have exceeded the recommended character length. You can simply ignore this and just ensure that each language meets the minimum and maximum character limit.

With that, your combined meta title should look like this:
[:en]Solution to Make Yoast work with qTranslate-X[:id]Solusi untuk Membuat Yoast SEO bekerjasama dengan qTranslate-X

You can do the same for the rest of the Yoast SEO fields and it should look like this:

Yoast SEO with qTranslate-X Meta Fields

[UPDATED] Issues with Yoast Meta Description and How to Solve It

You may have encounter issues with Yoast meta description even after implementing the above solution. Follow the steps below if your meta description display on Google SERP as such: [:en]Solution to Make Yoast work with qTranslate-X[:id]Solusi untuk Membuat Yoast SEO bekerjasama dengan qTranslate-X

Open your child’s theme function.php and add the code below:

function qtranslate_filter( $text ) {
return __( $text );
}
add_filter( 'wpseo_title', 'qtranslate_filter', 10, 1 );
add_filter( 'wpseo_metadesc', 'qtranslate_filter', 10, 1 );
add_filter( 'wpseo_metakey', 'qtranslate_filter', 10, 1 );
add_filter( 'wpseo_opengraph_title', 'qtranslate_filter', 10, 1 );

Go to /wp-content/plugins/wordpress-seo/js and look for this file: wp-seo-metabox.js

If the file doesn’t exist, you can create it and add the code below:

function yst_clean(str) {
if (str == '' || str == undefined)
return '';
try {
str = str.replace(/<\/?[^>]+>/gi, '');
} catch (e) {
}
return str;
}

How to test if it works?

There is a Google Chrome extension called SEO Meta in 1 CLICK which you can install and check the meta title, meta description, and many other SEO fields. Simply go to your page and click on the extension (usually located on the top right corner of your Google Chrome browser).

If you would like to check for the translated version of your Yoast SEO, simple make sure you are viewing the translated version on your browser before clicking on the SEO Meta in 1 Click extension.

Having trouble with Yoast SEO & qTranslate?

Let Us Help You
Irman Karim

Irman is passionate about web design and is always learning to upgrade his skills set. He is always on the lookout for new development trends and has a strong interest in search engine optimization as well as search engine marketing.

5 Comments

  • Moustic says:

    Hie. Are you sure your solution work?
    I have tested but the meta description display on the plugin show “[:fr]Ma description française.[:en]My english description.” et not only the description with the current language.

  • Irman Karim says:

    Hi
    Can you try this instead:
    [:fr]Ma description française.[:][:en]My english description.[:]

    Let me know if that works 🙂

  • Irman Karim says:

    We have updated this article to resolve the issue on Yoast Meta Description. Do let us know if you have any issues with the code above, thank you!

  • Ragul says:

    Hi Irman,

    I have added your codes in functions.php & created JS file as per your comments. Its work on Meta box. It means, previously there was all the languages contents showing. After adding your code, it works wonderful and now I can able to edit using “tab” as usual and works fine.

    WordPress Backend:
    But, I can still getting issues in the “Yoast Google Preview” on backend
    • In SEO Title the preview showing as –> [:en] Title [:de] Title [:sv] Title[:]
    • In Meta Description displaying as –> {:en} The content {:de} The content{:}

    Frontend Website:
    And in the Frontend “Page Source”
    Title Tag is Working Fine
    is Working Fine
    also Working Fine

    But the issue is on og:description section like below
    <meta property="og:description" content="{:en} The content {:de} The content{:}

    Thanks in Advance.

    • Irman Karim says:

      Hi Ragul

      Glad that the method works for you. You can ignore “Yoast Google Preview” on WordPress backend as it is pulling directly from what you keyed in on the WordPress SEO section. As for the og:description, are you able to provide me with the link to your website so that I can have a look?

      Cheers!

Leave a Reply