Pathauto and Token to get the first child term I am trying to create URL path aliases patterns with Tokens and Pathauto.

My main issue is how to I get the child of a parent of a taxonomy term? So my url is something like this.

[child-term:name]/[node:name]

In tokens help page I can see a lot [term:parent] references but not child ones. I am sure is something simple but in the vast amount of tokens I cannot seem to find it.
You can do quite advanced things with hook_pathauto_alias_alter to replace complex aliases patterns with just PHP code.

Here's how to use it:

/**
 * Implements hook_pathauto_alias_alter().
 */
function MYMODULE_pathauto_alias_alter(&amp;$alias, array &amp;$context) {
  // Make sure we're dealing with nodes
  if (isset($context['module']) &amp;&amp; $context['module'] == 'node') {
    // If this is a "my_content_type" content type
    if ($context['type'] == 'my_content_type') {
      $node = $context['data']['node'];

      // do stuff with $node, such as getting the taxonomy term
      // and loading the term.. then getting the children terms etc..

      // then assign a string value to $alias 
      $alias = pathauto_cleanstring($child_term-&gt;name) . '/' . pathauto_cleanstring($node-&gt;title); // for example...

      // Clean the alias
      $function = 'pathauto_clean_alias';
      if (function_exists($function)) {
        $alias = $function($alias);
      }

      // Now just make sure the alias generated is unique to this node.
      $function = 'pathauto_alias_uniquify';
      if (function_exists($function)) {
        $source = 'node/'.$node-&gt;nid;
        $lang = $node-&gt;language;

        $function($alias, $source, $lang);
      }
    }
  }
}