function hook_delete

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

Respond to node deletion.

This hook is invoked only on the module that defines the node's content type (use hook_node_delete() to respond to all node deletions).

This hook is invoked from node_delete_multiple() after the node has been removed from the node table in the database, before hook_node_delete() is invoked, and before field_attach_delete() is called.


$node: The node that is being deleted.

Related topics

82 functions implement hook_delete()

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

actions_delete in drupal/includes/
Deletes a single action from the database.
block_custom_block_delete in drupal/modules/block/
Form constructor for the custom block deletion form.
block_menu_delete in drupal/modules/block/block.module
Implements hook_menu_delete().
block_user_role_delete in drupal/modules/block/block.module
Implements hook_user_role_delete().
book_node_delete in drupal/modules/book/book.module
Implements hook_node_delete().

... See full list

3 invocations of hook_delete()
field_attach_delete in drupal/modules/field/
Delete field data for an existing entity. This deletes all revisions of field data for the entity.
field_purge_data in drupal/modules/field/
Purges the field data for a single field on a single pseudo-entity.
node_delete_multiple in drupal/modules/node/node.module
Deletes multiple nodes.


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


function hook_delete($node) {
  db_delete('mytable')->condition('nid', $node->nid)->execute();