I have a view where I want to use multiple termID's as arguments. I want to use a term name from the url and convert it to a termID. I've managed to do this easily enough and it works with simple 1 word terms or even multiple words by checking the 'Transform dashes in URL to spaces in term name arguments'

I have a few terms that have special characters eg: "news & politics".

Is there any way to have nice URL's (news-politics) and get views to recognise the correct term and convert it to the correct termID? Will I have to urlencode the ampersand? Will that even work?

Edit: You can setup path aliases for single taxonomy terms, but is a problem when you want to use the term name as a second argument in a path with multiple arguments eg:

Say I wanted to filter the view results by %1 News term then %2 News & Politics


second term would not be recognised.

  • Why you don't use term name as argument ?
    – dobeerman
    Commented Apr 6, 2011 at 20:25
  • Same issue. The ampersand is missing so drupal cant find the term. I think the only option is to either url encode the ampersand which SEO are not keen on or maybe storing a path alias for each term in the db. Just wondered if anyone has encountered this before and has a good strategy.
    – nickwshaw
    Commented Apr 7, 2011 at 10:14
  • Well as a short term solution we are going to just replace & with the word and. So News & Politics (news-politics) will be News and Politics (news-and-politics)
    – nickwshaw
    Commented Apr 7, 2011 at 11:34

2 Answers 2


You can use pathauto to set up automatic aliases for your taxonomy terms. Pathauto will take care of invalid url characters for you when it creates the automatic aliases. Then in your view use term id as the argument. The path of your view can either be taxonomy/term/% or the autoalias you set up/%


Due to a long-standing bug in the Views module reported at Issue #672606: Plus signs, dashes, and forward slashes (+-/) break arguments on Drupal.org, it is not possible to use as arguments (or "contextual filters" in more recent parlance) term names that contain certain special characters. A couple of workarounds are proposed there:

  1. Use something like Computed field (computed_field) module to create a URL-friendly field value on the term entity that can be used as an argument. Just be aware of the (slim?) chance of very similar terms clobbering each other if you aren't careful about uniqueness.
  2. Simply use term IDs for the arguments and create path aliases for them using View Alias (view_alias) module.

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.