The correct way to update Node path programmatically in Drupal 6

I am editing a node path programmatically similar to this in Drupal6:

$node = node_load(3);
$node->path = 'some/new/path';
node_save( $node );

This, of course, works, but the old alias remains. What is the best way to do this? I do not see any path functions or pathauto functions to remove the old alias. Or do I just need to remove the alias using SQL in the url_alias table?

+3
source share
1 answer

You use path_set_alias

To update the path, see path_nodeapi , for example.

path_set_alias('node/' . $node->nid, $node->path, isset($node->pid) ? $node->pid : NULL, isset($node->language) ? $node->language : '');
+4
source

All Articles