In drupal 8.9 I need to filter by taxonomy ID over multiple fields in the contextual filter of views.

How to do this ?


On the views edit page:

  • Under Advanced: Create a relation to the field that holds the refrence to the taxonomy id ("Taxonomy term referenced from field_your_field_name_that_holds_the_reference")
  • Under Advanced: Create a contextual filter for the Term ID and select the previous made relation as relationship. As final step click on "more" on the same page beneith, and select allow multiple.

Now you just add multiple taxonomy id's as 1+2+3 (for OR) or 1,2,3 (for AND).

And if you want to select on multiple fields: Repeat the process to add more fields and then you can do:

/1+2+3/877,454,453/345,345,345 Each slash represents the contextual filter field 1+2+3 is contextual filter one 877,454,453 is contextual filter two Etc.

  • thank you very much for your reply but the problem is that it doesn't look clean in the url even though it's just a value i want to test. Sorry to the time of my answer. – Agriesean Oct 9 '20 at 14:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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