Support » Plugin: Polylang » get_terms() ignores ‘lang’?

  • Hi,
    I am using a custom taxonomy with few terms, translated into three languages. I only want to get the terms in the current language, so I am doing this:

    $options = array(
    	'taxonomy' => 'event_category',
    	'hide_empty' => false
    if (function_exists('pll_current_language')) {
    	$options['lang'] = pll_current_language();
    $terms = get_terms($options);

    The $options array then includes ‘lang’ => ‘de’, but I am getting ALL the existing terms anyway. Doesnt matter what I use as the lang parameter, I am getting all the taxonomy terms in the database for the ‘event_category’ taxonomy.

    Is this a bug?

Viewing 7 replies - 1 through 7 (of 7 total)
  • I have ‘Custom Taxonomy Order NE’ plugin installed and as that might change how the query works, I have disabled it – it didnt help with the issue above.



    does you use Polylang or polylang pro ?

    Regular version, not the pro one.



    Sorry, I noticed this issue after installing pro, but on other website, I had same error, and my friend to.
    Wierd thing is

    says it should work. And it worked. Then it stopped.
    It seems to be a some kind of bug.
    I also want point – I use it in WP REST.
    I fixed it using:

    $positions_tax = get_terms( 'pos', $args );
            foreach ($positions_tax as $key => $tax) {
                if(pll_get_term_language($tax->term_id) !== $args['lang']){
            $positions_tax = array_values($positions_tax);

    Sorry for late answer 😉

    Oh yes, loading all the terms/posts and then filtering them manually works, thanks for the useful snippet!

    But I am very surprised there is no response/fix from the plugin author, this seems like a rather serious and annoying bug to me.

    Has this been fixed?I don’t see it working in polylang ( free version )

    Any soon plans to solve this? same issue here.

    • This reply was modified 3 weeks, 1 day ago by  alibasheer.
Viewing 7 replies - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.