• Resolved Rolf Allard van Hagen

    (@ravanh)


    Hi, trying Jetpack Search on a multi-lingual site created with Polylang, I notice Jetpack Search returns posts in all languages. A regular WordPress search does take the user selected language into account.

    Would it at all be possible to let a multi-language plugin, like Polylang or others, make Jetpack Search return results in only one language?

    Are there hooks available to filter results maybe?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Paulina H. (a11n)

    (@pehaa)

    Hey Rolf,

    Would it at all be possible to let a multi-language plugin, like Polylang or others, make Jetpack Search return results in only one language?

    Great question! This should be possible with the jetpack_instant_search_options filter. The code snippet from this comment in our GitHub repo should be helpful:

    add_filter( 'jetpack_instant_search_options', function($options) {
        $lang = pll_current_language();
    
        $options['adminQueryFilter'] = array(
            'bool' => array(
                'must' => array(
                    array( 'term' => array( 'taxonomy.language.slug' => $lang ) ),
                )
            )
        );
    
        return $options;
    } );


    Thread Starter Rolf Allard van Hagen

    (@ravanh)

    Excellent stuff! Thanks @pehaa ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Multi-language support?’ is closed to new replies.