Does anyone know of a standard way of creating a new node (a page node, for example) through code? I'm creating an installation profile and wanted to check before I go to inserting values directly into the DB.

Comments

john morahan’s picture

Here's an example for 4.7 which I think should still work:

http://drupal.org/node/60479#comment-114666

pcorbett’s picture

I came across node_save() last night and it looks to be what I'm looking for. Thank you for this. Also, if people need to do this and have menu items that need to be linked to, using the path_set_alias() function will insert values into the DB associating an alias to a node.