Support » Plugins and Hacks » [Resolved] Duplicate Results w/ WPML

[Resolved] Duplicate Results w/ WPML

  • Hey,

    we found that using Relevanssi + WPML would give us duplicate results (not mixed up results, just plain duplicates on the result list).

    So after investigating a bit, we solved it for us by uncommenting this part in function “relevanssi_wpml_filter” in common.php:

    if (function_exists('icl_object_id') && function_exists('pll_is_translated_post_type')) {
    				if (pll_is_translated_post_type($hit->post_type)) {
    				    if ($hit->ID == icl_object_id($hit->ID, $hit->post_type,false,ICL_LANGUAGE_CODE))
    				        $filtered_hits[] = $hit;

    seems like the condition is true for both WPML and Polylang as well.

    Would be nice if you could address this issue in one of your next update.



Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Mikko Saari


    Yes, this is a known bug and will be fixed in the next version.

    Could you please check one thing for me – does it work if you change the if on that block to elseif?

    So, elseif (function_exists('icl_object_id') && function_exists('pll_is_translated_post_type')) { and so on – does that work?

    hey Mikko,

    easy fix. yes it works with an “elseif” statement!


    This saved my weekend! Thanks for that! 😀

    I recently installed Version 3.3.4 and the duplication problem was there again.

    Fixed it by replacing the if with elseif on line 28


    elseif (function_exists(‘icl_object_id’) && !function_exists(‘pll_is_translated_post_type’)) {

    Maybe you could add that into the next release. cheers.

    Plugin Author Mikko Saari


    Yes, there was a bug in 3.3.4 with extra code remaining. This is actually already fixed – you can go download the Development version from the Developers tab, and that version already fixes the bug.

    Hi there,

    I’ve the latest version of Relevanssi, but still get duplicate results on the search page. I see the ‘elseif’ statement in the code, so that can’t be the problem.

    Hope you can help!

    My mistake! Didn’t see this checkbox yet:

    Limit results to current language: If this option is checked, Relevanssi will only return results in the current active language. Otherwise results will include posts in every language.

    It works perfectly now, thanks!!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Resolved] Duplicate Results w/ WPML’ is closed to new replies.