Is there a way to call a custom function after an entry is deleted successfully?

If there isn't, is there a record of the deleted record stored anywhere?

Currently, I am thinking of editing the actionPerformAction in elementIndexController, but I don't want to edit the application files, so if there is another method I would prefer that.


You can create a simple plugin that listens to the onDeleteEntry event.

There is an entry parameter passed into that event that is the EntryModel object that represents the entry that was just deleted.

  • craft()->on('entries.onDeleteEntry', function(Event $event) { Craft::log(" HELLO delete on delete ######\n\n", LogLevel::Info, true); }); I created a plugin and added this to the init function, but it isnt being called. Do you know why it might be? Also, I am using craft 2.6. – user2997606 Sep 22 '16 at 3:00
  • @user2997606 Just to check, did you remember to install your plugin via Settings -> Plugins? – Mats Mikkel Rummelhoff Sep 22 '16 at 4:03
  • @mats-mikkel-rummelhoff Yeah, I did that. – user2997606 Sep 22 '16 at 4:10
  • Hard to say without seeing your plugin code. Maybe post a new question with the relevant code in it? – Brad Bell Sep 22 '16 at 23:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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