WPML + Rank Math Issue

#993903
  • Hi there,

    I found a compatibility issue between Rank Math and WPML:

    When the canonical url of for example a woocommerce category page isn’t filled in manually, it will fill in the url of the page itself, which is good behavior.

    Although, when translating a page with WPML, it won’t change the canonical url. Example is in the sensitive data, together with our setup.

    When we fill in the canonical url’s manually, we are able to translate it of course. But that’s not ideal.

    Please let me know how we can fix this.

Viewing 14 replies - 1 through 14 (of 14 total)
  • Hello,

    We apologize for the issue you are facing with the compatibility between Rank Math and WPML regarding canonical URLs. Thank you for bringing this concern to our attention.

    It seems that when translating pages with WPML, the canonical URL does not automatically update to reflect the translated version, which can indeed be problematic. Unfortunately, the context does not provide a specific solution for this issue.

    As a workaround, you may need to manually set the canonical URLs for your translated pages to ensure they point to the correct versions. This can be done by visiting the product or category page in question, scrolling down to the Rank Math SEO Meta box, and navigating to Advanced → Canonical URL. Here, you can customize the canonical URL as needed.

    If you would like further assistance or if this issue persists, please reply to this ticket with your site URL and any additional details, and a human agent from the Rank Math Support team will take over and assist you further.

    Thank you for your understanding, and we look forward to resolving this for you!

    This is an automated reply from Rank Math Support Bot. Your ticket has been assigned to a human agent and we will get back to you shortly.

    Hi,

    I know that workaround. The question is if there is a better fix for this.

    Hello,

    Thank you for your query and we are so sorry about the trouble this must have caused.

    Please note that when handling translated versions of a post/page, it is handled by hreflang tag rather than the canonical tag so if you’re using translation plugins like WPML or TranslatePress, they handle the translated versions for you and Google will recognize them accordingly.

    You can however add the following filter on your website to force Rank Math to generate the self-referencing canonical URLs sitewide:

    add_filter( 'rank_math/frontend/canonical', function( $canonical ) {
        $current_url= "https://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
        $canonical = $current_url;
        return $canonical;
    });

    Here’s how you can add filter/hook to your WordPress site: https://rankmath.com/kb/wordpress-hooks-actions-filters/

    Hope that helps, and please do not hesitate to let us know if you need our assistance with anything else.

    Ok, thanks. This worked!

    Unfortunately the Next and previous tags (previous tags are missing completely I see), are still not translated.

    Is there a fix for these two problems too?

    Hello,

    Is your website built on a multisite environment? If it is, the correct way to use our plugins on a multisite setup is to install them on the network but only activate them on specific subsites.

    If you have activated the Rank Math plugin on the network, please deactivate it on the network and then activate it on the subsites.

    If the issue still persists, then please head over to your subsite’s WordPress Dashboard > Rank Math > Dashboard > Help, and from there disconnect and reconnect your Rank Math account and see if that helps to resolve the issue.https://rankmath.com/kb/installing-rank-math-on-a-multisite-environment/

    Let us know how it goes. Looking forward to helping you.

    Thank you.

    Hi Ike,

    No, we are not using a multisite environment. We are using a single site, but multidomain.

    Hello,

    Since you’re using a single-site setup with multiple domains, WPML should be handling the hreflang and pagination correctly. However, if the next/previous pagination tags are not translating properly, this may require additional configuration within WPML.

    If you have not yet done so consider installing the WPML SEO glue extension:
    https://wpml.org/compatibility/2021/04/wpml-seo-plugin-better-integration-with-seo-plugins/

    This extension is designed to enhance compatibility and may assist in resolving the issue.

    Also, ensure WPML’s “Adjust IDs for multilingual functionality” setting is enabled under WPML > Languages > SEO Options.

    Let us know how it goes. Looking forward to helping you.

    Thank you.

    Hello,

    Thanks! I already had the WPML SEO plugin activated.

    Can you tell me what this setting does exactly?

    “Also, ensure WPML’s “Adjust IDs for multilingual functionality” setting is enabled under WPML > Languages > SEO Options.”

    Hello,

    Please refer to https://wpml.org/wpml-hook/wpml_object_id/.

    WPML’s “Adjust IDs for multilingual functionality” setting, found under WPML > Languages > Make themes work multilingual, ensures that theme elements are displayed in the correct language by adjusting IDs for multilingual compatibility, and it is enabled by default.

    Don’t hesitate to let us know if you need our assistance with anything else.

    Thanks, that worked!

    Last question, our sitemap. both sitemaps contains both .nl and .be pages. See for example the product category sitemap.

    How to fix this?

    Hello,

    Please try to follow the steps below and see if that works for you:

    1. Flush the Sitemap cache by following this video screencast:
    https://i.rankmath.com/pipRDp

    2. Exclude the Sitemap files of the Rank Math plugin in your caching plugin. The cache could be via a plugin or from the server. For plugins or Cloudflare, please follow this article:
    https://rankmath.com/kb/exclude-sitemaps-from-caching/

    3. If the above steps don’t seem to work, kindly apply the following filter to your site.

    add_filter( 'rank_math/sitemap/enable_caching', '__return_false');
    

    Here’s how you can add filter/hook to your WordPress site:
    https://rankmath.com/kb/wordpress-hooks-actions-filters/

    Let us know how it goes. Looking forward to helping you.

    Thank you.

    Hello,

    Followed all the steps, unfortunately it’s still not working.

    Hello,

    The main domain sitemap will include the URLs of all the languages. This is the default sitemap implementation with WPML and our plugin.

    You only need to submit the main sitemap_index.xml to your GSC account and Google will be able to discover the URLs of each language from it.

    Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.

    Hi Ike,

    I would like to have only .nl links in the .nl sitemap and only .be links in the .be sitemap.

    Because I also got some errors now in Search Console.

    Is there a fix for this with some code maybe?

Viewing 14 replies - 1 through 14 (of 14 total)

You must be logged in to reply to this ticket.