I have a view that filters by different taxonomy terms, using multiple vocabularies. Im using the better exposed filter module.

I need different links to this view page which make different options pre-selected. By copying the url from when 1 term is selected I can easily make a link which works in this way:


I also need to make a link where all the terms from a vocabulary are selected. The client for this website will be able to add new terms to this vocabulary. If I simply copy the url with all the terms selected then this wont select a new term when its created.

How can I create a link to the view page which preselects all the terms from a vocbulary, that will still select all the terms when new ones are created?

1 Answer 1


Based on the URL provided:

function MODULE_NAME_build_taxonomy_views_link($taxonomy_tid) {
  $vocabulary = taxonomy_vocabulary_load($taxonomy_tid);
  if (!$vocabulary) {
  $term_ids = array();
  foreach (taxonomy_get_tree($taxonomy_tid) as $term) {
    $term_ids['tid'][] = $term->tid;

  return l($vocabulary->name, 'resources', array('query' => $term_ids));

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.