I am creating a node and a path alias roughly as follows:
<?php $node = (object) array( 'type' => 'article'); node_object_prepare($node); $node_wrapper = entity_metadata_wrapper('node', $node); // ... some more fields get set here... $node_wrapper->title->set( 'Foo' ); $node_wrapper->save(); // Set the path $path = array( 'source' => "node/$node->nid", 'alias' => "foo/bar", ); path_save($path);
The node is created OK, and the path seems to be created OK, too. I can type
foo/bar in as the path and I see the new blank page. However when I edit that page, the Path Alias is blank?!
I have pathauto installed - could this be something to do with it? Nb. when I edit the page the "Generate path automatically" pathauto checkbox is not checked (which is what I'd expect).