<p>I recently found that if your deleting an entry on the entries list, you need to use the onBeforePerformAction event. Then break this down, like J Thomas states on this -</p>

<p><a href="https://craftcms.stackexchange.com/questions/16831/get-the-type-of-action-and-the-elementss-that-an-action-is-being-performed-on">Get the type of action and the elements(s) that an action is being performed on when listening to elements.onPerformAction?</a></p>

CC BY-SA 3.0
2016-11-10T14:26:41.463Z
2016-11-10T14:26:41.463Z
2017-04-13T12:51:00.160Z
Jason Mayo
<p>I currently have a plugin which needs to do things on save and delete entry events. My save entry code is all working perfectly but the <a href="https://craftcms.com/docs/plugins/events-reference#entries-onDeleteEntry" rel="nofollow">onDeleteEntry</a> code doesn't ever fire when I delete an entry.</p>

<p>I have tried using the event both ways mentioned in the documentation</p>

<pre><code>craft()-&gt;entries-&gt;onDeleteEntry = function(Event $event) {
$entry = $event-&gt;params['entry'];
//etc etc
};
</code></pre>

<p>and</p>

<pre><code>craft()-&gt;on('entries.deleteEntry', function(Event $event) {
$entry = $event-&gt;params['entry'];
//etc etc
});
</code></pre>

<p>both of these are inside the init function.</p>

<p>Does anyone know if there is a particular way this event needs to be used that differs from the <a href="https://craftcms.com/docs/plugins/events-reference#entries-onSaveEntry" rel="nofollow">onSaveEntry</a> event, which works fine?</p>

<p>Here's a link to the events reference <a href="https://craftcms.com/docs/plugins/hooks-and-events#events" rel="nofollow">https://craftcms.com/docs/plugins/hooks-and-events#events</a></p>

CC BY-SA 3.0
2016-08-11T23:48:40.310Z
Were you testing this from the Entry index page by chance?
Brad Bell
CC BY-SA 3.0
2016-11-10T14:10:50.720Z
@BradBell I'm also having this same issue, when viewing the list of entries, ticking them and deleting them that way. Is there any way around this? (Using latest build of Craft)
Jason Mayo
<events><hook>
How to use onDeleteEntry?
# How to use onDeleteEntry?

(Asked by: username_0 on 2015-12-18)

I currently have a plugin which needs to do things on save and delete entry events. My save entry code is all working perfectly but the onDeleteEntry code doesn't ever fire when I delete an entry.
I have tried using the event both ways mentioned in the documentation
craft()->entries->onDeleteEntry = function(Event $event) {
$entry = $event->params['entry'];
//etc etc
};

and
craft()->on('entries.deleteEntry', function(Event $event) {
$entry = $event->params['entry'];
//etc etc
});

both of these are inside the init function.
Does anyone know if there is a particular way this event needs to be used that differs from the onSaveEntry event, which works fine?
Here's a link to the events reference https://craftcms.com/docs/plugins/hooks-and-events#events

**Tags:** events, hook

> **Comments:**
> **username_1**: Were you testing this from the Entry index page by chance?  
> **username_2**: @BradBell I'm also having this same issue, when viewing the list of entries, ticking them and deleting them that way. Is there any way around this? (Using latest build of Craft)  

---

## 1 answers

### Answer by username_2 on 2016-11-10. Score: 2 | Accepted answer

I recently found that if your deleting an entry on the entries list, you need to use the onBeforePerformAction event. Then break this down, like J Thomas states on this -

[Get the type of action and the elements(s) that an action is being performed on when listening to elements.onPerformAction?](https://craftcms.stackexchange.com/questions/16831/get-the-type-of-action-and-the-elementss-that-an-action-is-being-performed-on)


---

