Display parent term based on child term in views I have a vocabulary with the following structure:

Vocabulary
Parent term 1
    Child term 1.1
        Child term 1.1.1
    Child term 1.2
        Child term 1.2.1
Parent term 2
    Child term 2.1
        Child term 2.1.1
    Child term 2.2
        Child term 2.2.1


Based on the above structure of taxonomy terms, I have a view of all the terms of last level like,

Child term 1.1.1
Child term 1.2.1
Child term 2.1.1
Child term 2.2.1


Now, i want to create the view, which list me 2nd level of taxonomy term by passing term id of the 3rd level.


  Example:- If i pass term id of Child term 2.2.1 in contextual filter, i should see the Child term 2.1 as a result of view.
You need to add Taxonomy term: Parent term in RELATIONSHIPS of the view.



Then in the field section select the Relationship



That's it. Whatever term you enter in the contextual filter it fetches the parent term of it.

Here is entire exported view (example).

$view = new view();
$view-&gt;name = 'tag_relation';
$view-&gt;description = '';
$view-&gt;tag = 'default';
$view-&gt;base_table = 'taxonomy_term_data';
$view-&gt;human_name = 'Tag relation';
$view-&gt;core = 7;
$view-&gt;api_version = '3.0';
$view-&gt;disabled = FALSE; /* Edit this to true to make a default view disabled initially */

/* Display: Master */
$handler = $view-&gt;new_display('default', 'Master', 'default');
$handler-&gt;display-&gt;display_options['title'] = 'Tag relation';
$handler-&gt;display-&gt;display_options['use_more_always'] = FALSE;
$handler-&gt;display-&gt;display_options['access']['type'] = 'perm';
$handler-&gt;display-&gt;display_options['cache']['type'] = 'none';
$handler-&gt;display-&gt;display_options['query']['type'] = 'views_query';
$handler-&gt;display-&gt;display_options['exposed_form']['type'] = 'basic';
$handler-&gt;display-&gt;display_options['pager']['type'] = 'full';
$handler-&gt;display-&gt;display_options['pager']['options']['items_per_page'] = '10';
$handler-&gt;display-&gt;display_options['style_plugin'] = 'default';
$handler-&gt;display-&gt;display_options['row_plugin'] = 'fields';
/* Relationship: Taxonomy term: Parent term */
$handler-&gt;display-&gt;display_options['relationships']['parent']['id'] = 'parent';
$handler-&gt;display-&gt;display_options['relationships']['parent']['table'] = 'taxonomy_term_hierarchy';
$handler-&gt;display-&gt;display_options['relationships']['parent']['field'] = 'parent';
/* Field: Taxonomy term: Name */
$handler-&gt;display-&gt;display_options['fields']['name']['id'] = 'name';
$handler-&gt;display-&gt;display_options['fields']['name']['table'] = 'taxonomy_term_data';
$handler-&gt;display-&gt;display_options['fields']['name']['field'] = 'name';
$handler-&gt;display-&gt;display_options['fields']['name']['relationship'] = 'parent';
$handler-&gt;display-&gt;display_options['fields']['name']['label'] = '';
$handler-&gt;display-&gt;display_options['fields']['name']['alter']['word_boundary'] = FALSE;
$handler-&gt;display-&gt;display_options['fields']['name']['alter']['ellipsis'] = FALSE;
$handler-&gt;display-&gt;display_options['fields']['name']['element_label_colon'] = FALSE;
$handler-&gt;display-&gt;display_options['fields']['name']['link_to_taxonomy'] = TRUE;
/* Contextual filter: Taxonomy term: Name */
$handler-&gt;display-&gt;display_options['arguments']['name']['id'] = 'name';
$handler-&gt;display-&gt;display_options['arguments']['name']['table'] = 'taxonomy_term_data';
$handler-&gt;display-&gt;display_options['arguments']['name']['field'] = 'name';
$handler-&gt;display-&gt;display_options['arguments']['name']['default_action'] = 'empty';
$handler-&gt;display-&gt;display_options['arguments']['name']['default_argument_type'] = 'fixed';
$handler-&gt;display-&gt;display_options['arguments']['name']['summary']['number_of_records'] = '0';
$handler-&gt;display-&gt;display_options['arguments']['name']['summary']['format'] = 'default_summary';
$handler-&gt;display-&gt;display_options['arguments']['name']['summary_options']['items_per_page'] = '25';
$handler-&gt;display-&gt;display_options['arguments']['name']['limit'] = '0';
/* Filter criterion: Taxonomy vocabulary: Machine name */
$handler-&gt;display-&gt;display_options['filters']['machine_name']['id'] = 'machine_name';
$handler-&gt;display-&gt;display_options['filters']['machine_name']['table'] = 'taxonomy_vocabulary';
$handler-&gt;display-&gt;display_options['filters']['machine_name']['field'] = 'machine_name';
$handler-&gt;display-&gt;display_options['filters']['machine_name']['value'] = array(
  'tags' =&gt; 'tags',
);

/* Display: Page */
$handler = $view-&gt;new_display('page', 'Page', 'page');
$handler-&gt;display-&gt;display_options['path'] = 'tag-relation';