Get AI SEO for FREE.

Learn More!

Multilingual SEO with WPML & Rank Math SEO – Setup and Optimization

There are almost 7,000 languages in the world, and English is just one of them. So, depending on the purpose of your site and your target audience, only considering audiences that speak English could be an oversight.

The potential target market is huge, and with a multilingual website, you can make your website more accessible to other markets.

Fortunately, Rank Math SEO makes it very easy for you to optimize your content for your multilingual website. It does this by working in conjunction with WPML – a popular WordPress Multilingual Plugin.

Rank Math SEO and WPML work hand-in-hand to offer you customization, optimization, and translation of your content. With these two plugins, you will have fully translated and fully optimized content that will please your non-English and English speakers alike (or any language speaker, for that matter).

Let’s see how you can use Rank Math SEO and WPML to translate and optimize your content.

1 What is WPML? An Introduction & Overview

By default, WordPress supports only one language at a time. But if you want to use multiple languages on a site to attract a different demographic, then WPML is the right choice for you.

WPML(WordPress Multilingual Plugin) helps to make your website multilingual, and you can create content in many different languages. The interface is extremely easy to use for managing the translations. Not only this, but it also adds language switching options for your visitors. With WPML, search engines easily understand your site’s structure and drive the right traffic to the right languages.

Let us now look how you can create a multilingual WordPress website without any hassle.

2 Getting Started

First things first, make sure you have the latest version of Rank Math SEO and WPML installed on your WordPress Website. And the good news is that Rank Math is now integrated with the WPML SEO glue plugin. This “glue” plugin allows for easier translation of your SEO content using WPML. You can download it from your WPML account’s Downloads page or by visiting the Plugins section of your site’s admin to have a seamless multilingual workflow.

You can install Rank Math and WPML both from WordPress Dashboard → Plugins → Add New.

First, search for the Rank Math plugin and install it:

Install Rank Math

Then, activate it from the same page.

After that, install the WPML plugin by going to WordPress Dashboard → Plugins → Add New. Point it to where you have downloaded your WMPL files and activate the plugin after it is done uploading.

Install WPML

Once you are done installing both plugins, it is time to do some translations.

3 Translate Everything vs Translate Some

With WPML’s Translate Everything feature, you no longer need to translate your on-page text manually. WPML facilitates translating the site content along with the on-page SEO attributes automatically, so you only have to review them before publishing.

Head over to WPML → Settings and then choose “Translate Everything” as Translation Mode.

WPML - Translated Everything

And you’ll find translations waiting for your review at WPML → Translation Management.

WPML translation waiting for review

On the other hand, if you prefer to translate your website content yourself, work with a local translators team, or send your content for translation to professional translation services, WPML allows you to do so in the “Translate Some” mode.

While choosing the mode is completely based on your preference, we’ll get started with translating the meta titles, meta descriptions, on-page text, breadcrumbs, and other similar texts.

4 Translating the General SEO

Certain strings are added to your images and breadcrumbs automatically by Rank Math SEO. These strings are added in English by default, but you can change them to any language easily.

Head over to WordPress Dashboard → WPML → String Translation.

Choose admin_texts_rank-math-options-general from the dropdown.

General String Translation

Then, proceed to change the strings to any number of languages you like.

Take a note of the “Name” column. It gives you an idea of where the String is coming from.

For example, [rank-math-options-general]breadcrumbs_home_label the string is the text for the “Home” string in Breadcrumbs.

Breadcrumbs Translation

Likewise, all other strings adjacent to breadcrumbs column belong to the Breadcrumbs, and you can change those as required.

5 Translating Titles & Meta Texts

Rank Math SEO offers you plenty of options to customize your title and descriptions. You can automate the title and meta description process with various variables we offer. You can use a combination of hard-coded texts along with variables to generate a unique meta title or description automatically for your posts, pages, products, or CPTs.

For such hard-coded texts, you can translate them into other languages using WPML, and the process is very easy to follow.

Head over to WordPress Dashboard → WPML → String Translation

Then, choose admin_texts_rank-math-options-titles from the strings within domain dropdown.

Translate Title Strings

Once you identify the string you want to translate, click the “+” sign next to it. A new dialog box pops up, and you can add your translation here.

Strings into another language

Note: Translate the static text only as translating the variable text will break the secondary language pages. For example, the Spanish translation for “Static Text %title% %sep% %sitename%” will be “Texto estático %title% %sep% %sitename%”

6 Translating On-Page Text

Let’s talk about translating the nitty-gritty of your website – that is, the post or page content itself in the Translate Some mode.

It is extremely easy with Rank Math SEO + WMPL. You can open the settings for translating your post in a couple of ways

From your post listings page:

Translate Post Listings

Or, from the post’s sidebar:

Translate Post Content

A new page with a bunch of options will appear where you can translate your text either manually or via Machine translation.

Let’s talk about the manual translation first and then we will discuss Machine translation.

WPML gives you an option to translate your titles, your text, your image alt texts, or any textual content for that matter.

Translate Post Text Manually

Once done, hit the save button and, Voila!

Your page is now translated into a language of your choice and WPML creates a new page for that translation automatically.

7 Machine Translating Your Text

Manually translating your posts is not possible sometimes. Especially, if you are translating your content to more than one language.

WPML offers a neat option for automatically translating your content to any language with the help of Machine translation, when you’re in the Translate Some mode.

Follow the instructions we shared in Section 4 above right up till the point where you add the translations manually.

Instead of manually translating, we will be using the Machine Translation feature of WPML.

automattic-translation-wpml

When you are on the translations page, locate the “Translate automatically” button and press it.

You will a checkbox of options you can choose from. Review the options and choose the one that applies to you.

Click the “Translate” button and see the magic unfold 🙂

All your content is automatically translated with just a couple of clicks.

8 Creating Sitemaps for Other Languages

Rank Math automatically creates a sitemap of all your posts. And, your translated posts/pages are no different.

A link to each translated post/page is automatically added to your sitemap index available at domain.com/sitemap_index.xml

WPML adds hreflang to the translated pages so Google can figure out that a particular page is a translated version of another page on your website.

If you submitted the main sitemap index to Google or other search engines, you do not need to make any changes, and the translated pages will be automatically picked by the search engines from your sitemap.

9 Localizing the Plugin Text

If you want to use the plugin in your local language, you only need to download the language from WordPress Dashboard → Updates.

Rank Math displays the translated version of posts and categories in the Sitemap. If you choose other language URL formats, WPML will take care of it by creating hreflang tags and the search engines know the default language of the page’s content and also the translation which is available in different languages.

10 Multilingual Websites and Duplicate Text

A translated piece of your original content is considered to be a unique piece of content by Google and other search engines. So, you do not need to worry about causing duplicate content issues when translating your website into multiple languages.

WPML adds a hreflang tag to your translated pages which makes it easier for Google to understand and classify your translated content.

Rank Math SEO adds a proper canonical tag to each translated post/page to ensure Google and other search engines know where the original piece of content is located.

11 Solutions to the Most Common Problems

Let us now look at some of the solutions to the problems that are faced by our users while using WPML.

11.1 Rankmath SEO Adds Incorrect Entries for Translated Homepages in the Sitemap

This is one of the common issues faced by the users where incorrect entries are added for the secondary homepage in the sitemap ‘/page_sitemap.xml’

For example, if your default homepage has the slug’ homepage’ and the translations are ‘homepage-fr’, ‘homepage-it’, then the sitemap shows:
https://www.yourwebsite.com/ (which is correct)
https://www.yourwebsite.com/fr/homepage-fr (incorrect as it should be https://www.yourwebsite.com/fr/)
https://www.yourwebsite.com/it/homepage-it (incorrect as it should be https://www.yourwebsite.com/it/)

If you’re facing this issue, then please add the following piece of code anywhere in your theme’s rank-math.php file:

if ( 'page' === get_option( 'show_on_front' ) ) {
    add_filter( 'rank_math/sitemap/entry', 'compsupp_5514_filter_sitemap_home_page_entry', 10, 3 );
}
function compsupp_5514_filter_sitemap_home_page_entry( $url, $type, $post ) {
    global $sitepress;
    static $wpml_home_urls = null;
    static $frontpage_translations = null;
    static $default_frontpage_id = null;
    if ( ! $wpml_home_urls ) {
        $active_languages = $sitepress->get_active_languages();
        $wpml_home_urls   = [];
        foreach ( $active_languages as $code => $language ) {
            $wpml_home_urls[ $code ] = $sitepress->language_url( $code );
        }
        $default_frontpage_id   = get_option( 'page_on_front' );
        $frontpage_trid         = $sitepress->get_element_trid( $default_frontpage_id, 'post_page' );
        $frontpage_translations = array_map( \WPML\FP\Obj::prop( 'element_id' ), $sitepress->get_element_translations( $frontpage_trid, 'post_page' ) );
    }
    if ( in_array( $post->ID, $frontpage_translations ) && $post->ID !== $default_frontpage_id  ) {
        $language_code = array_search( $post->ID, $frontpage_translations );
        $url['loc']    = $wpml_home_urls[ $language_code ];
    }
    return $url;
}

Note: We recommend that please take a backup of your website’s file and database before making any changes to the code.

11.2 Rank Math SEO + WooCommerce Missing “Shop” Breadcrumbs

The Shop breadcrumb is missing on the users WooCommerce pages with WPML enabled. This occurs only in secondary languages where the slug for Shop has been translated.

If you’re facing this issue, please add the following piece of code anywhere in the rank-math.php file:

// Fixes missing "Shop" breadcrumb in WPML translated store pages.
if( function_exists( 'icl_object_id' ) ) {
    add_filter( 'rank_math/frontend/breadcrumb/items', 'wpmlsupp_8672_fix_wc_store_breadcrumbs', 10, 2 );
}
function wpmlsupp_8672_fix_wc_store_breadcrumbs( $crumbs, $class ) {
    if ( is_product() || is_product_category() || is_product_tag() ){
        $current_language = apply_filters( 'wpml_current_language', NULL );
        $default_language = apply_filters( 'wpml_default_language', NULL );
        if ($current_language !== $default_language) {
            $shop_page_id = wc_get_page_id( 'shop' );
            $shop_page    = get_post( $shop_page_id );
             
            $store_crumb = array (
                '0' => get_the_title( $shop_page ),
                '1' => get_permalink( $shop_page ),
                'hide_in_schema' => ""
            );
            array_splice( $crumbs, 1, 0, array( $store_crumb ) );
        }
    }
    return $crumbs;
}

11.3 How to Translate the Meta Description or Titles of Rank Math Plugin

WPML creates a new post for each language, and WPML handles the translation of all the custom fields. You can manage which fields to translate from the WPML Settings.

The WPML prevents updating the post-meta fields when set to Translate instead of Copy once, i.e., copying the field value from the original post only once. In addition, when it is set to Translate, the WPML plugin doesn’t allow changing the post meta value from the translated posts.

In this case, you can head over to WPML Settings and change the Custom fields translation to Copy once from the Settings as shown below:

Custom Fields Translation

Click Save to save the changes.

12 Conclusion

Rank Math and WPML make it extremely easy to create multi-language websites with ease. They do so without the hassle of manually dealing with various issues that are usually a part of creating multilingual websites.

This is yet another reason WordPress is the best content management system – it truly takes the hassle out of creating multilingual websites with the help of WPML to handle the translations and Rank Math SEO to handle the optimization/proper technical SEO for international websites so you can focus your business. If you’ve absolutely any questions, please feel to get in touch with our support team directly from here, and we’re always here to help you.

Still not using Rank Math?

Setup takes less than 5 minutes including the import from your old SEO Plugin!

Learn more about the PRO Version

Still need help?

?

Submit Your Question

Please give us the details, our support team will get back to you.

Open Ticket

Related Articles