Pathauto tokens for taxonomy terms except root Thanks to pathauto and tokens it is very easy to generate URLs with [node:field_product_category:entity:parents:join-path]/[node:field_product_category:entity]/[node:title] \o/

But … I would like to start at the 2nd level, so is it possible to exclude the root level from [node:field_product_category:entity:parents:join-path]?

Example

What I have got: http://www.example.com/redundant_root_category/category_from_level_2/category_from_level_3/super_product

What I want: http://www.example.com/category_from_level_2/category_from_level_3/super_product
The default tokens won't allow you to do this, but the only thing you're missing I think is an array token that removes the first element, I'd call it "tail". See token_token_info(), which defines for example a 'reversed and other array tokens:

$info['tokens']['array']['reversed'] = array(
  'name' =&gt; t('Reversed'),
  'description' =&gt; t('The array reversed.'),
'type' =&gt; 'array',
);


And the implementation for that is in token_tokens():

// [array:reversed:*] chained tokens.
if ($reversed_tokens = \Drupal::token()-&gt;findWithPrefix($tokens, 'reversed')) {
  $replacements += \Drupal::token()-&gt;generate('array', $reversed_tokens, array('array' =&gt; array_reverse($array, TRUE)), array('array sort' =&gt; FALSE) + $options, $bubbleable_metadata);
}


Instead of array_reverse(), you'd call array_shift() on the array first and then pass that along.

Might also be a useful standard token to have in the token.module, if someone wants to provide a patch.

Your token would then look like this:

[node:field_product_category:entity:parents:tail:join-path]