Same name and namespace in other branches
  1. 4.6.x developer/hooks/node.php \hook_delete()
  2. 5.x developer/hooks/node.php \hook_delete()
  3. 6.x developer/hooks/node.php \hook_delete()
  4. 7.x modules/node/node.api.php \hook_delete()

Respond to node deletion.

This is a hook used by node modules. It is called to allow the module to take action when a node is being deleted from the database by, for example, deleting information from related tables.

Parameters

&$node: The node being deleted.

Return value

None.

To take action when nodes of any type are deleted (not just nodes of the type defined by this module), use hook_nodeapi() instead.

For a detailed usage example, see node_example.module.

Related topics

20 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.

block_box_delete in modules/block.module
Menu callback; confirm deletion of custom blocks.
book_delete in modules/book.module
Implementation of hook_delete().
comment_delete in modules/comment.module
Menu callback; delete a comment.
contact_admin_delete in modules/contact.module
Category delete page.
fileupload_delete in developer/examples/fileupload.module
Implementation of hook_delete().

... See full list

File

developer/hooks/node.php, line 110
These hooks are defined by node modules, modules that define a new kind of node.

Code

function hook_delete(&$node) {
  db_query('DELETE FROM {mytable} WHERE nid = %d', $node->nid);
}