• Resolved fernandosumun

    (@fernandosumun)


    Hi, thanks for your great plugin.

    I’m facing a problem in a WPML translated site:

    • Custom post type and custom taxonomy registered.
    • In WPML they are configured as “Translatable: use translation if available or fall back to default language”

    When I search by term name I only get results if search query is in the main language, no matters which language is active in frontend. For example:

    Term (SPA/ENG):
    – Bajolavabos/Basin units

    Posts in term:
    – L01
    – L02
    – L03
    – …

    Frontend language: SPA
    Search query: Bajolavabos -> Result: all posts in term
    Search query: Basin units -> Result: empty

    This is OK in spanish (main language), but if I switch to english or any secondary language, I get the same results, when the expected are
    Search query: Bajolavabos -> Result: empty
    Search query: Basin units -> Result: all posts in term

    Thanks in advance!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Sumit Singh

    (@5um17)

    Hi,

    I am not sure about this. I need to test with Display as translated feature.

    I hope you have set CPT and Taxonomy both to display as translated not just one.

    Please let me know do you still need help with this?

    Thanks

    Plugin Author Sumit Singh

    (@5um17)

    Hi,

    I tested this feature. The problem arise when you translate the category and do not translate the post in it.

    WPML adjust the taxonomy query for display as translated feature but in case of WPES it does use taxonomy query instead uses SQL join because WPES is not matching the full terms instead matching partial term name so it can not use taxonomy query.

    Now for on secondary language when you search for “Bajolavabos” default language posts are matched and displayed and WPML allows them and adjust the link because of display as translated feature.
    This can be avoided if you wish, please add this code in theme functions.php

    
    add_action('wp_es_terms_relation_type', function (){
    	add_filter('wpml_should_use_display_as_translated_snippet', '__return_false');
    });
    

    This will turn off display as translated feature for search query and using WPES.

    When you search for “Basin units” it has no translated post so does not match anything. And display as translated feature is ineffective because of above explanation. I am sorry I can not do much here but as soon as you start translating posts it will display the expected results.

    Hope it helps.
    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘WPML – Search by term name’ is closed to new replies.