Main menu

Drupal 7: Taxonomy language filter is absent in Views

Published by dnovikov on Thu, 08/25/2011 - 17:35

When we have Taxonomy translation module enabled we can set taxonomy translation mode to "Translate" - this means that different terms can be created for each enabled language on the site. But when we output these terms with Views ("Taxonomy" view type) they're not filtered automatically by the current language and we can't override this applying a filter... language filters are absent for taxonomy terms. I found a quick solution with few lines of code:

function mymodule_views_query_alter(&$view, &$query) {
  if (
$view->name == 'yourviewmachinename') {
$query->where[] = array(
'conditions' => array(array(
'field' => 'taxonomy_term_data.language',
'value' => array('***CURRENT_LANGUAGE***'),
'operator' => 'in',
'args' => array(),
'type' => 'AND',


Hi there! I'm at work surfing around your blog from my new apple iphone! Just wanted to say I love reading through your blog and look forward to all your posts! Carry on the excellent work!

Hey, thank you for the good words!

Hey There. I found your blog using msn. This is a very well written article.
I'll be sure to bookmark it and return to read more of your useful information. Thanks for the post. I'll certainly comeback.

This works great!! Thank you.
I've been looking for a solution all day !


very interesting posts, thanks.
only a detail, could you show your date posts, please?
when i look in internet for info on programing, since it is a changing world, i look always the solutions date.

thanks again :)

Candelas, this article may be helpful but it is the old one. look at the post date .)

Add new comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.