I'm trying to execute some code right before content is deleted. The Rules module has events for

  • After updating existing content
  • Before saving content
  • After saving new content
  • After deleting content

However, none of these execute my code at the right time. Is there a way to easily add new events? If so, where should I hook? My knowledge of the Drupal core is very small.


What I'm doing is updating a menu link that links to the content in the database, but as the update code only runs after having deleted the content, there isn't any row to be updated because Drupal apparently deletes menu items that link to non-existent content.

  • Is this for Drupal 6 or Drupal 7? In Drupal 6 the node is deleted and the delete hooks are then called. In 7 it's the other way around.
    – Dave
    Commented Dec 13, 2011 at 10:53
  • This is Drupal 7. The delete hooks appear to be executing too late, as the menu item will already have been deleted in the database.
    – Beerdude26
    Commented Dec 13, 2011 at 16:11

1 Answer 1


You might be looking to implement hook_delete().

You can also check node_delete_multiple() in node.module, if you want to have an idea of what Drupal core does when it delete nodes...there's other hooks that get called as well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.