function hook_insert

7.x node.api.php hook_insert($node)

Respond to creation of a new node.

This hook is invoked only on the module that defines the node's content type (use hook_node_insert() to act on all node insertions).

This hook is invoked from node_save() after the node is inserted into the node table in the database, before field_attach_insert() is called, and before hook_node_insert() is invoked.


$node: The node that is being created.

Related topics

42 functions implement hook_insert()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

ajax_command_insert in drupal/includes/
Creates a Drupal Ajax 'insert' command using the method in #ajax['method'].
book_node_insert in drupal/modules/book/book.module
Implements hook_node_insert().
comment_node_insert in drupal/modules/comment/comment.module
Implements hook_node_insert().
comment_node_type_insert in drupal/modules/comment/comment.module
Implements hook_node_type_insert().
db_insert in drupal/includes/database/
Returns a new InsertQuery object for the active database.

... See full list

2 invocations of hook_insert()
field_attach_insert in drupal/modules/field/
Save field data for a new entity.
user_save in drupal/modules/user/user.module
Save changes to a user account or add a new user.


drupal/modules/node/node.api.php, line 1153
Hooks provided by the Node module.


function hook_insert($node) {
    'nid' => $node->nid,
    'extra' => $node->extra,