I am editing a node's path programatically like this in Drupal6:
$node = node_load(3);
$node->path = 'some/new/path';
node_save( $node );
That of course works, but the old alias remains. What's the best way to do this? I see no path functions or pathauto functions to remove the old alias. Or do I simply need to remove the alias using SQL on the url_alias table?
You shoud use path_set_alias
To update a path, take a look at path_nodeapi, e.g. :
path_set_alias('node/' . $node->nid, $node->path, isset($node->pid) ? $node->pid : NULL, isset($node->language) ? $node->language : '');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With