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

Onur tarafından
0 kez okundu

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.

<?php
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.

0
Kan Themes
wordpress
Bir Cevap Yaz

Senin Cevabın

E-posta hesabınız yayımlanmayacak. Gerekli alanlar (*) olarak işaretlendi.