Category sitemaps with WPML

#122511
  • Resolved Anfuca
    Rank Math free

    Hi,
    we have a multisite WordPress with WPML installed and 2 languages working, spanish and english.
    The posts and pages sitemaps are perfect, but the category’s not.

    The spanish sitemap contains both, the spanish and english categories.
    The english sitemap contains both, the spanish and english categories.

    Is anything I can do to fix this?

    Thanks in advance

Viewing 4 replies - 1 through 4 (of 4 total)
  • Anfuca
    Rank Math free

    Ok, added a filter like this:

    add_filter( 'rank_math/sitemap/entry', function( $url, $type, $object ){
    if (ICL_LANGUAGE_CODE === 'es' && $type === 'term' && strpos($url['loc'], '/en/') {
    } else {
      return $url;
    }

    It’s working by now and it’s a temporal fix. Is another way to achieve it?

    Hello,

    Thank you for getting in touch with us.

    Rank math usually adds all your URLs under the default sitemap URLs. The translations differentiation is done using hreflangs added to the individual pages. Other translation sitemap URLs are automatically handled by WPML, not Rank math.

    Please check this guide on doing translations with Rank Math and WPML:
    https://wpml.org/documentation/plugins-compatibility/optimize-multilingual-websites-using-rank-math-and-wpml/ especially under the section How Rank Math sitemaps work with WPML

    Hope this helps you.

    Anfuca
    Rank Math free

    Thanks Michael. I see that hreflang it’s ok in the final pages.
    What I want to say is that the english version of page-sitemap.xml has only the english URLs.
    And the spanish version of page-sitemap.xml has only the spanish URLs.
    But the category-sitemap.xml version of both languages, has both URLS spanish and english…

    Right now it’s working with the workaround I’ve posted before.

    I’ve read the article from WPML and nothing is said about the categories. I will put in contact with them.

    Thanks

    Hello,

    I understand your issue.

    Given the translated sitemap are usually handled automatically by WPML, I believe getting in touch with them as a better idea. Do let us know how it goes.

    Looking forward to helping you.

    Hello,

    Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.

    If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.

    Thank you.

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

The ticket ‘Category sitemaps with WPML’ is closed to new replies.