Using Simple Hierarchical Select Module in Drupal 7

The Simple hierarchical select module or SHS for short implements a widget element that allows users to drill down through a hierarchical list of terms within a vocabulary. The module implements a custom formatter, widget and Views filter. You can create a views listing page that allows users to filter content using SHS. The module only works with vocabulary terms so you’ll need to have Taxonomy enabled to use this module.

Getting Started

Download and install Simple hierarchical select and make sure you have the core Taxonomy module enabled. If you installed Drupal using the standard installation profile, then Taxonomy would be enabled.

Throughout this tutorial, we’ll use the Tags vocabulary and Article content type that comes with the standard installation profile.

Configure Simple Hierarchical Select Widget

The first piece of functionality we’ll look at is the widget. Let’s now setup the custom widget on the Article content type.

1. Go to Structure -> Content types (admin/structure/types) and click on the “Manage fields” link within the Article row.

2. Click on the “edit” link for the Tags field.

Fig 1.0

3. From the Tags edit page, click on the “Widget type” tab in the top right corner.

Fig 1.1

4. Select “Simple hierarchical select” from the “Widget type” drop-down and click on the Continue button.

Fig 1.2

5. Once you click on the Continue button, you’ll be redirected back to the “Manage fields” page. Now, go back to the edit page for the Tags field.

6. Scroll down the page, and you should see a “Simple hierarchical select settings” field-set. In this field-set, you can configure the SHS widget.

Fig 1.3

Check the “Allow creating new terms” and “Allow creating new levels” checkboxes. This will allow a user to create new terms directly from the node edit page, but make sure you have setup the vocabulary permissions properly.

Scroll to the bottom and click on “Save settings”.

Taxonomy Terms

Go to the Tags vocabulary administration page and add some terms.

If the “Allow creating new terms” option in field settings page isn’t checked or you don’t have any terms, then the widget will not display.

For this tutorial, I added in a bunch of terms like the ones below.

Fig 1.4

Simple Hierarchical Select in Action

Now that everything has been setup, go to Content -> “Add content” -> Article (node/add/article). You should see the Tags widget as a drop-down. When you select an option, another drop-down will appear to the right.

Fig 1.5

If you need to add a new term, select the “<add new item>” and enter the term into the text field and click the Save link.

Fig 1.6

Simple Hierarchical Select Formatter

The module ships with a formatter that displays the hierarchical order of a term. For example, if you select a term only the single term is displayed and the parents terms are not visible.

Here is an image of the standard term formatter.

Fig 1.7

Go to the “Manage display” page and select “Simple hierarchy” from the Format drop-down list. If you go back to a node page, you should see the parent term.

Fig 1.8

Views Integration

As stated earlier, the module also offers a filter for Views. Using the filter is pretty easy, just create a Views page and select the “Content: Has taxonomy terms (with depth; Simple hierarchical select)” filter.

Fig 1.9

If you have any questions, please leave a comment.

About the Author

Ivan is the founder of Web Wash and spends most of his time consulting and writing about Drupal. He's been working with Drupal for 6 years and has successfully completed several large Drupal projects in Australia.

Leave a Reply 74 comments

Stefan - February 12, 2013 Reply

Thank Ivan!
I’ve linked this great tutorial on the project page of Simple hierarchical select.

Steven - February 13, 2013 Reply

I find it quite useful also for the menu system. Especially if you have a deep menu hierarchy, much better than a normal confusing select field.

David Picciuto - February 13, 2013 Reply

I’ve been looking for something like this forever!

gangadhara u - February 27, 2013 Reply

I am trying to use hierchial select in views but it is displaying all categories and subcategories in same dropdown i want subcategories to be displayed after selecting the categories

    Ivan Zugec - February 27, 2013 Reply

    Does the same hierarchical list work on the node form? Make sure you select the “Content: Has taxonomy terms (with depth; Simple hierarchical select)” filter.

Anonymous - March 1, 2013 Reply

I was so relieved to find this module for Drupal 7. Of course, after taking a moment to be overjoyed, I got right down to nuts and bolts issues. Is it possible to resolve the unclean urls resulting from the exposed shs filters in Views? An example of one of my results is: I would much prefer to display the selected terms in the url. Thank you for the tutorial.

    Ivan Zugec - March 1, 2013 Reply

    This is more related to Views (filters) and not SHS module. In Views you should be able to change the “shs_term_node_tid_depth” to something else. If you don’t want “shs_term_node_tid_depth=503” to be displayed in the URL, you’ll have to search for a module that cleans up the filter URLs.

      Anonymous - March 15, 2013 Reply

      Thank you for your reply. Yes, when I edit the filter in my View, “Filter identifier” can be specified after clicking on “More.” (Following Administrative title.) At least I can get rid of “shs_term_node_tid_depth” that way, which leaves only the leading “?” and the “=503” term id. Much better, if not perfect.

naddoo - March 8, 2013 Reply

I am using drupal 7 with simple hierarchical select and better exposed filters and it works fine. Now I want to change the display of exposed filter from “Default select list” to “Links” so that I can see all my taxonomies as links without dropodown box. In the BEF Settings of the exposed filters I can choose to display as links, but at the filter no taxonomies are displayed. Can you help me?

thanks in advance

    Ivan Zugec - March 8, 2013 Reply

    I haven’t used SHS this way. But it seems to me that the module doesn’t support an exposed filter as “Links”.

Michel - March 15, 2013 Reply

Hello and thank you for this tutorial.
I encounter a problem with the taxonomy when what is translated into different languages​​.
When the user changes language on the site, shs does not use the new language taxonomy taxonomy but uses the default language of the site.
Can you help me ….

    Ivan Zugec - March 15, 2013 Reply

    Sorry I can’t help you, I have never worked on a multilingual Drupal website

Mirkozzo - March 17, 2013 Reply

is there a way to publish the path in the node of the taxonomy father and son?

example: Drupal>version 8.x

    Ivan Zugec - March 17, 2013 Reply

    Just select the “Simple hierarchy” formatter from the “manage display” section.

Mirkozzo - March 26, 2013 Reply

how can you change the delay of Hierarchical’s dropdown menù ?

    Ivan Zugec - March 26, 2013 Reply

    As far as I’m aware, the delay is not configurable. If you do want to change it, I would look at the shs.js file.

Mirkozzo - March 26, 2013 Reply

thanks for the reply.
unfortunately I do not know javascript, could you tell me where to intervene in the script?

    Ivan Zugec - March 27, 2013 Reply

    I don’t know where in the code, you’ll have to research that.

Peter - March 27, 2013 Reply

great work on this tutorial!

any demo sites you can point me to?

paolo - April 10, 2013 Reply

Hi Ivan, thank you for your tutorial. I tryed to use HS but now i’m going to use SHS. Can you please just anticipate me if is possible ( with Drupal 7) :
– use SHS with a three level hierarchical taxonomy term
– use in a view more SHS exposed filters based on different taxonomy terms
– enable user to choose not only the deepest level of the hierarchy but also the intermediary levels

Thank you in advance

    Ivan Zugec - April 10, 2013 Reply

    I think this module does meet your specific requirements. But I do recommend that you spend some time using the module.

    Test the module using

Alex - April 15, 2013 Reply

Hi Ivan! at first – thank you for this module. it’s very useful! ,
but i have a little problem – when choose child term in node (by shs) – after save node – “node” doesn’t saving in parent term…- only in child… so it’s difficult to understand how to show parent term in views page… and also how to show node in parent taxonomy term page. do you have any solution for this problem?

Thank you in advance,

    Ivan Zugec - April 16, 2013 Reply

    This is how the taxonomy system works. When you assign a term to a node, you are simply assigning the selected term child or parent.

    What I recommend is create a custom view which overrides the “taxonomy/term/tid” page and play around with the contextual filter so that the content attached to the parent terms are displayed.

      Alex - April 19, 2013 Reply

      Thank you for answer. (Certainly it’s my problem – you already make a Great work.. – but may be you answer) the problems:

      1. When users add new node – it will be better for user to add taxonomy term in “one line” (as usual hierarh select) – now he can do it (in shs) in two lines “first line” -> parent term, then “second line” parent term again -> then child therm – to save in two levels of taxonomy (unfortunately most part of users don’t like to read my comments how add info in node) – to “save” two terms.
      (* autocompilte and usual hierarh select doesn’t work for my tasks – you module is More better! because users can easy add new parent and child terms if they are not in dictionary, and because in shs it’s possible easy to add many “lines” like parent->child,,, parent->child…)

      as an example what i want to do (when users add new node ):
      node (for example “apples”) – user add node:

      russian apples (parent) -> “name of sort 1” (child)
      russian apples (parent) -> “name of sort 2” (child)
      german apples (parent) -> “name of sort 2″ (child)

      … it’s easy for user to edit and add node – now in shs it’s possible just:
      russian apples (parent)
      russian apples (parent) again, then ->”name of sort 1” (child)….

      2. Second problem (because first problem)
      for an example user want to see parent term -(russian apples) – he can’t see in parent term “name of sort 1” (child term) if in node doesn’t saves two levels, also i have many views with filters, many static information with count nodes in parent and child terms…so it will be the best for me to save in parent and child terms at ones in shs…

      Sorry for so much text…

      so question is – can you help? where to see in your module to edit to solve my problem… of cause i program by myself.

      Thank you for your answer.

        Ivan Zugec - April 20, 2013 Reply

        Sorry, I did not write this module so I don’t have any experience with the code.

        If I understand correctly, you want the parent term attached to the node as well as the child term. Look at using Rules ( or write some custom code when a node is saved.

Neil - April 17, 2013 Reply

Hi Ivan – having trouble selecting parent terms. Only seems to allow selections from deepest level terms irrespective of whether or not the Force selection of deepest level option is checked or not. Have you managed to get this working?



    Ivan Zugec - April 18, 2013 Reply

    Try clearing site cache and make sure the “Force selection of deepest level” option is unchecked.

vishal - April 23, 2013 Reply

Hi Ivan,

I made taxonomy like this, country1

But, i want to show it in front end in dropdown manner. for example, in 1st dropdown country1, country2, country3.. should be shown.
according to 1st dropdown the second dropdown of states of that country should be appear.
same as according to 2nd dropdown the 3rd dropdown of regions of that states should be appear.
how can i do this? I have lots of confusion regarding this.

how can i show it in front end?
please help.



    Ivan Zugec - April 23, 2013 Reply

    Where on the “front end” will you show it? As part of a views listing page? Also, are country1, country2, etc.. are they separate vocabularies?

      vishal - April 30, 2013 Reply

      Hi Ivan,

      Simply i want to display 3 dropdowns which are dependent of each other using any thing means using view or using other things.
      i don’t know how to do it?
      and country 1, country 2, etc.. are in same vocabulary. and country1, country2,..etc are perent terms and states are the child terms of country and regions are the child terms of states means regions are the grand child of country in same vocabulary. can u tell me the flow of how can i generate 3 level dropdowns which are dependent of each other using view or anything?

mgomma - April 29, 2013 Reply

Hi Ivan i used the module to create an exposed filter but i faced a problem that after submitting the filter it redirect to the homepage with no data not the term view page that has the right nodes and so the filter work on that view result

so i need help to avoid that issue ?

Denis - May 8, 2013 Reply

Hi Ivan,
I just wanted to ask few questions:

#1 – I need do display 2 dependent drop-downs: “state” and “city”. When “state” is chosen, drop-down “city” becomes visible. Is there any way that “city” would be visible all the time, even “state” isn’t chosen?

#2 – Is it possible to add text label for the child drop-downs, in my case that would be “city”, and if so, how to do it?

Thanks in advance

    Ivan Zugec - May 8, 2013 Reply

    In regards to your first question, you can’t. That is how the module works. First you select a parent then a child term.

    And I don’t understand your 2nd question. Which text labels?

    Don - August 25, 2013 Reply

    download conditional fields module, that is your best option…am using it on the site am developing now…its pretty easy to figure out…i recommend a youtube video…cos i used it too…This one is more like a menu that display child item….

    Thanks Ivan…am using this for my site now…though am using it for taxonomy only…just had a delay problem…it shows up slowly

Miguel - May 9, 2013 Reply

Hello Ivan and thank you for this tutorial.
Is there a way to create filter shs for user view?
Thanks in advance.

    Ivan Zugec - May 9, 2013 Reply

    Sorry, what do you mean by “user view”?

      Miguel - May 9, 2013 Reply

      Thank you Ivan. Excuse me for my English

      Add new view
      Type: User
      Add Filter criteria:
      ¿”Content: Has taxonomy terms (with depth; Simple hierarchical select)” ?

      … in Spanish:
      Quiero crear una vista de usuarios (View Tipe: User) con un filtro shs, pero al seleccionar el filtro no aparece “Content: Has taxonomy terms (with depth; Simple hierarchical select)”

      ¿Se puede crear un filtro SHS en una vista “Tipe: User”, o solamente se puede utilizar en vistas “Type: Content”

        Ivan Zugec - May 10, 2013 Reply

        The SHS module should work on a listing page of user entities. But make sure you have a taxonomy term reference field on the user entity.

          Oliver - June 27, 2013 Reply

          Unfortunaly i can`t get it to work with the a user view. Could you be a little more specific about the settings ? I have a multi level taxonomy called regions. I want to use SHS on a user view.
          Thx and cheers for the great post!

          Ivan Zugec - June 28, 2013 Reply

          The SHS module only works with “taxonomy term reference” and “entity reference” fields. If you want to use this module to display a list of users, then use the “entity reference” to reference users.

          Below is a link to the SHS views filter for “entity reference”.

          Oliver - June 28, 2013 Reply

          Thx for the answer. So the additional handler is now in the handler folder. Do i have to add a entity reference field in the user ? Or do i have to create a new View on Taxonomy Terms and reference to the user somehow? Sorry, but i still do not understand how to make things work. I have my view of users. What to do now ?

          Ivan Zugec - June 28, 2013 Reply

          Try the following steps on a test Drupal website. You’ll need to know how to create content types, fields and a basic Views page.

          – Create a content type.
          – Add an entity reference field that references the user entity.
          – Then, create a Views page and add the entity reference field as a filter. When you configure the filter there should be a “Output filter as hierarchical select” checkbox.

          Try the above steps, it’s all I can offer as a comment. A proper step-by-step guide will be the size of a tutorial.

dharper - May 14, 2013 Reply

Hi Ivan, Great module – Thanks!

Only thing on my ‘wish list’ is an option to have views filter on parent taxonomy term. It’s kind of the way you have the numbering working, but views only looks to the child term.

Meaning if I had
Veggies (5) …..

and I wanted to sort on Fruit to get a taxonomy list of all the fruit.

Thanks again for a great module!


    Ivan Zugec - May 15, 2013 Reply

    Hi Dan,

    First of all, I didn’t write this module. You can thank the module maintainers for this great module. 🙂

    Sorry, I do not understand the problem. 🙁 The parent terms are shown in the exposed filter.

    Also, the numbers in the tutorial image is just part of the term name, that’s it.

Al - May 15, 2013 Reply


Bonzer tutorial!

I have been working on a very large vocabulary using HS. However, I am running into a lot of problems and want to shift to SHS. Will my vocabulary survive if I make the change?



    Ivan Zugec - May 15, 2013 Reply

    The HS and SHS module never change vocabularies or terms within the vocabularies. You won’t have to change vocabularies or terms to use the other module.

    You can easily switch between modules. 🙂

      Al - May 15, 2013 Reply


      Please buy yourself a beer and send me the bill!



Fares - May 21, 2013 Reply


my request is that how can i make it obligatory to choose -BMW and –1er but the —114 is optional.
besides if i tell HS to select from deepest level, it removes the labels that i want, and it automatically select the first car, so anyone could simply press next and continue.

    Ivan Zugec - May 22, 2013 Reply

    You can’t do that with SHS module. You’ll have to implement a custom solution.

David - May 29, 2013 Reply

Is it possible to use something like that as a search block that user can filter content based on hierarchical taxonomy? How can we do that?


david - June 4, 2013 Reply

Hi any idey why the views filter throws no result on taxonomy field inside field colection.
child filtering works ok just parent term.
Thank you

    Ivan Zugec - June 5, 2013 Reply

    After a quick google search, I found this issue “”. It looks like the module does not support field collections yet.

Winnie - July 27, 2013 Reply

Hi Ivan,
Thank you so much for the awesome and thorough tutorials! They’ve saved me many times and I appreciate you taking the time to do this. It’s made learning Drupal a lot easier. Looking forward to learning more from you!

Thanks again

Paul Bonczyk - August 16, 2013 Reply

hi Ivan
I’m wondering if your module can help me in my view of files. I have an exposed filter of ‘taxonomy’ term which presents as a very long select box – very hard to use.
I have deployed SHS with great success on a view of a content type but for the view of files (file entities do have a taxonomy reference field), there are no ‘content: ‘ options or “Output filter as hierarchical select” possibility.
We have 400 editors on our site who would much appreciate any help you could offer me.

Paul Bonczyk - August 16, 2013 Reply

thanks for your swift reply.
I suspect the same – that it isn’t built for other entity types such as file. I’ll ask on the SHS issues queue.
thanks, Paul

Paul Bonczyk - August 16, 2013 Reply

checked on the project site and the issue is already raised – seems SHS does not currently support other entity types.

    Ivan Zugec - August 17, 2013 Reply

    Thanks for the update.

genius.ha - August 21, 2013 Reply

how exposed multi select in to shs??

    Ivan Zugec - August 21, 2013 Reply

    Sorry I don’t understand your question. 🙁

genius.ha - August 21, 2013 Reply

I want you on my views of parents choosing vocabulary that a child’s vocabulary in the select list to select multi select
I have a chak box.
With this module, I can do this?
How did it right away ?
If this module does not do it after you’ve introduced a module

    Ivan Zugec - August 22, 2013 Reply

    No I don’t think this is possible with SHS.

Brian - November 7, 2013 Reply

Is SHS compatible with Profile2? Or does it only work with nodes? When selecting terms via the widget (a) the parent terms does not saved (and I do not have the force deepest level enabled) and (b) the values do not get loaded into the widget on the /user/[uid]/edit/[profile] page.

    Ivan Zugec - November 7, 2013 Reply

    Yes, SHS only works with nodes.

    Profile2 implements its own entity type.

Joe - November 12, 2013 Reply

First off thank you for a great tutorial!

I’ve got the module set up and working fine. However I’m looking to import items using Feeds but I can only select the name of the field and not specifiy parent or children terms. Any ideas?


    Ivan Zugec - November 12, 2013 Reply

    Sorry, I don’t understand the question. It looks to me you have an import issue with Feeds.

Leave a Reply: