I have a multilingual website (WPML). How can I make search results be from all languages?


I would like that when I search for a term then the results will be from ALL languages. I found this code, which doesn’t look “safe” to me.

add_action('pre_get_posts', 'wpml_custom_query');
function wpml_custom_query($query)
    if (is_search()) {
        $query->query_vars['suppress_filters'] = true;

The problem with this code is that the results contain duplicates from different languages. I would like in that case just to show the article from the current language.
How do I approach this? Thank you for your time.

IT goldman 5 months 2022-07-06T16:15:13-05:00 0 Answers 0 views 0

Leave an answer