Query all language terms
-
Hi Chouby,
In the documentation, I read :
Is it possible to query multiple languages?
Yes. Example:$posts = get_posts(array( 'post_type' => 'post', 'lang' => 'de,fr', // query German and French posts 'showposts' => 5 ));
I have two questions (which might have already been asked and answered but the WordPress support forums are impossible to search through) :
1. Is there a way to include all languages without knowing them?
Something like the parameter ‘lang’ => ‘all’ (or a *, or empty)… If not, is there maybe a constant that can be set just like for WP Super Cache will be switched off whenever the constant DONOTCACHEPAGE is set to 1 ?2. Is there something similar for get_terms() to query all language terms?
This does not seem to work :$terms = get_terms(get_query_var('taxonomy'), array( 'orderby' => 'count', 'order' => 'DESC', 'lang' => 'de,fr', // query German and French posts 'hierachical' => 0, 'number' => 50000 ));
and pll_get_term() does not cut it since I need all terms including non-translated ones.
Or maybe there is a way to loop through all site languages and switch to each one dynamically, each time running get_terms() ?
- The topic ‘Query all language terms’ is closed to new replies.