Filter language in Polylang for custom taxonomy
I'm trying to filter custom taxonomy by language. To achieve this, I use WP_Query class with the following arguments:
$args = array(
'post_type' = ['post', 'page'],
'post_status' = 'publish',
'lang' = $language,
'tax_query' = array(
array(
'taxonomy' = $taxonomy_custom_category,
'field' = 'name',
'terms' = $taxonomy_term,
),
),
);
Where $language is one of the language retrieved by pll_languages_list()
.
However, except for the language by default, the query results is always empty. Is there any way to build a form with Polylang filtered by language that returns the correct results for a custom taxonomy?
Topic plugin-polylang multi-language custom-taxonomy Wordpress
Category Web