I can't seem to make hook_pathauto_alias_alter() get called in my custom module, in either 1.x or 2.x. I'm not certain, but I'm not clear if this hook is even in pathauto 1.x.

I am trying to hook into a Pathauto alias right before it's saved, so I can make some changes to the path (remove certain words). How do you do this? Is there another method besides a hook in the Pathauto module?

I have a module that let's the user enter in a list of words they want to filter from nodes; I would prefer not to enter it in two places.

1 Answer 1


The UI has this built in as it happens, if you visit http://mysite.com/admin/build/path/pathauto and look in the "General Settings" fieldset you'll find a textbox containing a list of strings to remove from aliases:


hook_pathauto_alias_alter is definitely the right way to do it; it's available in both the 1.x and 2.x branches. Have you run any debug code to see if the hook is actually being called? And did you clear the caches? Hook implementations are cached (in Drupal 7 anyway; I can't remember if they are in Drupal 6 or not).

In case you're still wondering most modules that declare hooks come with a MODULENAME.api.php file which lists those hooks and how to use them. In the case of pathauto the file and hook function declarations are there, but sadly there's no documentation.

  • Thanks! I cleared cache a few times and wasn't seeing it called (I tossed in a die()). Can you point me where in the code of pathauto 1.x this hook is defined?
    – Justin
    Mar 9, 2012 at 22:33
  • 1
    Oh brain-dead friday! Somehow this hook is working after trying again. Maybe I spelled it wrong? Ugh ugh ugh sad face. Thanks! If you make this suggestion an answer I will accept.
    – Justin
    Mar 9, 2012 at 22:35
  • @Justin Will do, glad you got it sorted :)
    – Clive
    Mar 9, 2012 at 23:19

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.