Answers.Body: <p>You can create a <a href="http://pluginfactory.io" rel="nofollow">simple plugin</a> that listens to the <a href="https://craftcms.com/docs/plugins/events-reference#entries-onDeleteEntry" rel="nofollow">onDeleteEntry</a> <a href="https://craftcms.com/docs/plugins/hooks-and-events#events" rel="nofollow">event</a>.</p>
  
  <p>There is an <code>entry</code> parameter passed into that event that is the <a href="https://craftcms.com/docs/templating/entrymodel" rel="nofollow">EntryModel</a> object that represents the entry that was just deleted.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-09-22T03:00:24.833Z
Answers.Text: 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.
Answers.UserDisplayName: user2997606
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-09-22T04:03:06.373Z
Answers.Text: @user2997606 Just to check, did you remember to install your plugin via Settings -> Plugins?
Answers.UserDisplayName: Mats Mikkel Rummelhoff
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-09-22T04:10:01.077Z
Answers.Text: @mats-mikkel-rummelhoff Yeah, I did that.
Answers.UserDisplayName: user2997606
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-09-22T23:10:38.220Z
Answers.Text: Hard to say without seeing your plugin code. Maybe post a new question with the relevant code in it?
Answers.UserDisplayName: Brad Bell
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-09-22T00:20:43.577Z
Answers.LastActivityDate: 2016-09-22T00:20:43.577Z
Answers.UserDisplayName: Brad Bell
Body: <p>Is there a way to call a custom function after an entry is deleted successfully?</p>
  
  <p>If there isn't, is there a record of the deleted record stored anywhere?</p>
  
  <p>Currently, I am thinking of editing the <code>actionPerformAction</code> in <code>elementIndexController</code>, but I don't want to edit the application files, so if there is another method I would prefer that.</p>
  
Tags: <plugin-development>
Title: Calling a plugin function after an entry is deleted?
ThreadText: # Calling a plugin function after an entry is deleted?
  
  (Asked by: username_0 on 2016-09-21)
  
  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.
  
  **Tags:** plugin-development
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-09-22. Score: 2 | Accepted answer
  
  You can create a [simple plugin](http://pluginfactory.io) that listens to the [onDeleteEntry](https://craftcms.com/docs/plugins/events-reference#entries-onDeleteEntry) [event](https://craftcms.com/docs/plugins/hooks-and-events#events).
  
  There is an `entry` parameter passed into that event that is the [EntryModel](https://craftcms.com/docs/templating/entrymodel) object that represents the entry that was just deleted.
  
  > **Comments:**
  > **username_0**: 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.  
  > **username_2**: @username_0 Just to check, did you remember to install your plugin via Settings -> Plugins?  
  > **username_0**: @username_2-mikkel-username_2 Yeah, I did that.  
  > **username_1**: Hard to say without seeing your plugin code. Maybe post a new question with the relevant code in it?  
  
  ---
  
  