• Resolved vmweb

    (@vmweb)


    Hi,
    I’m working with WPML plugin version 3.5.3.1 on my website. There are 3 languages: english, italian and japanese.

    When I search something in english I would like to find results in all languages. So in Relevanssi options I unchecked “Limit results to current language”.

    It seems work good and I find results in all languages. But when I click on an another language post, it opens current language translation of that post. I would like it opens the correct language version instead.

    For example:
    In english I search “mercato centrale”.
    It found an italian post named “mercato centrale” but the permalink of the listed post is that of the english version:
    https://mywebsite.com/en/central-market
    instead of:
    https://mywebsite.com/it/mercato-centrale

    Can you help me please?

    Best regards

Viewing 1 replies (of 1 total)
  • Thread Starter vmweb

    (@vmweb)

    Sorry, it wasn’t a problem with Relevanssi.
    I resolved the issue switching language before printing the post permalink.

    If it can help someone here the code:

    $wpml_info = wpml_get_language_information($post->ID);
    $post_language = $wpml_info['language_code'];
    $sitepress->switch_lang($post_language, true);
    get_template_part('templates/content', 'search');
    $sitepress->switch_lang(ICL_LANGUAGE_CODE, true);

    Best regards

Viewing 1 replies (of 1 total)
  • The topic ‘Wrong language permalink with WPML’ is closed to new replies.