I'm trying to save a node code wise (like I've done a dozen times before), but for some reason, my custom URL given with the Pathauto module, disappears... The Generate automatic URL alias checkbox is checked and Drupal ignores my custom URL...

I've tried to give a custom URL with the URL-alias like:

$path = 'events/blablabla';
$node->path = array('alias' => $path);

But that didn't work out either. So I'm wondering what do I do wrong. As far as I can see, there seems to be a bug in the module, but I have no clue how to solve this.

2 Answers 2


You'll need to set:

$node->path = array('alias' => $path, 'pathauto' => FALSE);
  • This should be the accepted answer! Nov 16, 2016 at 17:53

As this similar question points out, its as easy as:

  $node->path['pathauto'] = 0;

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.