• Hi, so I’ve noticed there are some issues between RankMath and Polylang.

    So far, I’ve been able to determine these conflicts:

    1. Activating the option Remove Category Base will cause inaccessible category archives;
    2. The XML Sitemaps have multiple issues: (a) for pages will only show the root homepage, not language specific homepages (b) for categories will only show URLs from the first configured language (c) for custom taxonomies will only show URLs from the default language;
    3. The Google News sitemap uses the default site language for each post;
    4. Breadcrumb text strings are not translated;

    Only for the breadcrumb text strings I have a working solution in place now. And I’ll try to remember and convey to other site admins to never touch the Remove Category Base option.

    But is is possible somehow to hook into the sitemap generation process and append language specific homepages and taxonomy term archives ? And set the correct language in the news sitemap?

    Thanks for any thoughts 🙂

    • This topic was modified 2 months, 1 week ago by Rolf Allard van Hagen. Reason: added one more conflict: news sitemap language
Viewing 15 replies - 1 through 15 (of 38 total)
  • Plugin Support Rank Math Support

    (@rankmathsupport)

    Hello @ravanh,

    Thank you for contacting Rank Math support.

    Please follow this guide to make Polylang compatible with our plugin and fix the sitemap issue: https://rankmath.com/kb/polylang-compatibility/

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

    Thread Starter Rolf Allard van Hagen

    (@ravanh)

    Thanks! Any chance this will make it into the plugin itself, like the WPML compatibility code?

    Plugin Support Rank Math Support

    (@rankmathsupport)

    Hello @ravanh,

    Unfortunately, there may not be any chance to include this compatibility to our plugin.

    We have been trying to collaborate with them for a few years but left the conversation when they refused to add the compatibility even though they have it for several other plugins (some of them have a smaller user-base compared to RM)

    https://github.com/polylang/polylang/tree/master/integrations

    You can check their public repository where we created a pull request (linked to from your opening post) a few years back and we would have maintained it (though that would not have happened ideally since we do not make changes in the plugin that breaks the compatibility).

    Disappointingly, compatibility needs to be added to their plugin as they added other SEO plugins. We are more than committed to making that happen and always keep it updated, of course, if their team agrees and wants to collaborate.

    Thread Starter Rolf Allard van Hagen

    (@ravanh)

    That’s sad to hear. But why does the compatibility code need to be in Polylang? Can it not be added (as a Helper) in RankMath? Or published as a separate plugin on the repository?

    Well, it’s just a thought, because not everybody uses a custom theme or is able to modify theme files…

    Plugin Support Rank Math Support

    (@rankmathsupport)

    Hello @ravanh,

    We understand your concern. While adding compatibility code directly into Rank Math or publishing it separately are options, integrating it into Polylang ensures smoother performance and updates for users.

    For now, the alternative implementation is via the KB guide we have previously shared in this thread.

    Thank you.

    Thread Starter Rolf Allard van Hagen

    (@ravanh)

    Ok, so for a site that is not using a custom theme, I’m now trying to integrate this code using an mu-plugin file:

    https://gist.github.com/RavanH/522d26f2dd2801d8b1b01cdcc5e72219

    I’ve simplified the action hook (relying on the class constructor instead of calling init) and as far as I can tell, the class is loaded on pll_init.

    But I’m not seeing any results… :/

    What’s wrong with my code?

    Thread Starter Rolf Allard van Hagen

    (@ravanh)

    Wait, I do see one result: the rel canonical and next link head tags are now correct (as long as I set the block theme template query loop block to use the default query)

    But breadcrumb strings are not translated, nor are the sitemap issues fixed… Has the code been tested recently?

    Plugin Support Rank Math Support

    (@rankmathsupport)

    Hello @ravanh,

    We have just created a new installation of WordPress and installed Rank Math + Polylang to make sure the implementation is still very much accurate and we can see the translation strings and sitemaps displaying correctly.

    Here is one example of what we get when we head over to Languages > Translations: https://i.rankmath.com/i/tVdx2e

    And here is how the sitemap looks with a single post in 2 languages: https://i.rankmath.com/i/vrL0a7

    Since you are using this on a plugin that might be causing issues and not working as expected, so we would recommend for now to keep using the method we shared in the article above.

    Thank you.

    Thread Starter Rolf Allard van Hagen

    (@ravanh)

    Ok, now please compare your results to the same test setup without the compatibility code. You’ll notice that the translation strings are still there (only their Group will have changed from “rank-math” to “plugins/seo-by-rank-math”) and all post languages are still in the post and pages sitemaps.

    Also, when the compatibility code is active, the sitemap issues I described in the OP are not resolved…

    Plugin Support Rank Math Support

    (@rankmathsupport)

    Hello @ravanh,

    Without the compatibility code, the sitemap doesn’t display the translations. The most likely reason you are still seeing them is because your sitemap is cached but if you clear the cache on it you’ll see the updated results.

    The cache on it can be cleared like so: https://rankmath.com/kb/exclude-sitemaps-from-caching/

    As for the translations, if you check closely you’ll see that the number of translatable strings increases with the compatibility code.

    Some of the strings are detected automatically because we set them to be translatable with default WordPress functions but the compatibility adds additional ones which are not detected.

    Don’t hesitate to get in touch if you have any other questions.

    Thread Starter Rolf Allard van Hagen

    (@ravanh)

    There is no cache active on the site, nor the server… Are you saying that RankMath is caching the sitemap?

    Plugin Support Rank Math Support

    (@rankmathsupport)

    Hello @ravanh,

    The sitemap could be cached with the transient cache. Please use the following filter on your site to disable it for the sitemap and fix the issue: https://rankmath.com/kb/exclude-sitemaps-from-caching/#transient-cache

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

    Thread Starter Rolf Allard van Hagen

    (@ravanh)

    Hi, thanks for thinking with me and helping me along 🙂

    I’ve now updated my compatibility code on https://gist.github.com/RavanH/522d26f2dd2801d8b1b01cdcc5e72219 a bit:

    • rank_math/frontend/breadcrumb/strings filter
    • pruned autodetected translation strings
    • moved language homepages to the page sitemap

    But I still need a fix for:

    1. Google News sitemap language tags
    2. A way to undo or prevent someone activating the Remove Category Base option (if at all possible, otherwise just an admin warning maybe)
    Plugin Support Rank Math Support

    (@rankmathsupport)

    Hello @monoor,

    Thank you for contacting Rank Math support, and sorry for any inconvenience that might have been caused due to that.

    Could you please confirm if you’re using a template or Elementor template for your shop page?

    If so, then you can try to add the following filter on your website and see if that works for you:

    add_filter( 'rank_math/opengraph/pre_set_content_image', function( $return ) { if(is_shop()){ return true; // Set to true if you don't want to set image from Content. } });

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

    Hope that helps.

    Thread Starter Rolf Allard van Hagen

    (@ravanh)

    Hi @rankmathsupport, that answer does not seem to belong in this thread…

Viewing 15 replies - 1 through 15 (of 38 total)
  • You must be logged in to reply to this topic.