<p><strong>Bulk actions do not trigger their respective events.</strong> When you delete an entry (or multiple entries) via the checkboxes, you are performing a bulk action.</p>

<p>As a workaround, you can listen to the <a href="https://craftcms.com/docs/plugins/events-reference#elements-onBeforePerformAction" rel="nofollow noreferrer">onBeforePerformAction</a> or <a href="https://craftcms.com/docs/plugins/events-reference#elements-onPerformAction" rel="nofollow noreferrer">onPerformAction</a> events, check to see if the action parameter to see if it's the action you're interested in and perform  your logic as necessary. *</p>

<blockquote>
  <p><em>* Much of this answer was copied from my &amp; Brad's answers on <a href="https://craftcms.stackexchange.com/questions/8460/delete-change-status-from-cp-via-ajax-trigger-event">this similar thread...</a></em></p>
</blockquote>

CC BY-SA 3.0
2016-09-22T06:18:09.550Z
thanks for the response. I tried this: craft()->on('entry.onPerformAction ', function(Event $event) {
  Craft::log(" on delete ######\n\n", LogLevel::Info, true);
 }); . Doesn't seem to work, I tried it with just 'onPerformAction' as well, it doesn't work then either.
user2997606
CC BY-SA 3.0
2016-09-22T05:57:21.820Z
2016-09-22T05:57:21.820Z
2017-04-13T12:50:59.930Z
Lindsey D
<p>I have the following code:</p>

<pre><code>namespace Craft;

class AffiliatesExportPlugin extends BasePlugin
{
  //All other functions

  public function init() {
    craft()-&gt;on('entries.onDeleteEntry', function(Event $event) {
      Craft::log(" on delete ######\n\n", LogLevel::Info, true);
    });
  }
}
</code></pre>

<p>I added this as a plugin activated the plugin, but when I delete an entry, it doesn't seem to get triggered. What am I doing wrong?</p>

CC BY-SA 3.0
2016-09-22T05:49:00.747Z
How did you delete it? From the entry's edit screen? Or from the entries index screen (via the checkbox)?
Lindsey D
CC BY-SA 3.0
2016-09-22T05:49:45.320Z
@lindsey-d Through the check boxes
user2997606
<plugin-development><events>
'onDeleteEntry' Event is not triggered when an Entry is deleted?
# 'onDeleteEntry' Event is not triggered when an Entry is deleted?

(Asked by: username_0 on 2016-09-22)

I have the following code:
namespace Craft;

class AffiliatesExportPlugin extends BasePlugin
{
  //All other functions

  public function init() {
    craft()->on('entries.onDeleteEntry', function(Event $event) {
      Craft::log(" on delete ######\n\n", LogLevel::Info, true);
    });
  }
}

I added this as a plugin activated the plugin, but when I delete an entry, it doesn't seem to get triggered. What am I doing wrong?

**Tags:** plugin-development, events

> **Comments:**
> **username_1**: How did you delete it? From the entry's edit screen? Or from the entries index screen (via the checkbox)?  
> **username_0**: @lindsey-d Through the check boxes  

---

## 1 answers

### Answer by username_1 on 2016-09-22. Score: 3 | Accepted answer

**Bulk actions do not trigger their respective events.** When you delete an entry (or multiple entries) via the checkboxes, you are performing a bulk action.

As a workaround, you can listen to the [onBeforePerformAction](https://craftcms.com/docs/plugins/events-reference#elements-onBeforePerformAction) or [onPerformAction](https://craftcms.com/docs/plugins/events-reference#elements-onPerformAction) events, check to see if the action parameter to see if it's the action you're interested in and perform your logic as necessary. \*

> *\* Much of this answer was copied from my & Brad's answers on [this similar thread...](https://craftcms.stackexchange.com/questions/8460/delete-change-status-from-cp-via-ajax-trigger-event)*

> **Comments:**
> **username_0**: thanks for the response. I tried this: craft()->on('entry.onPerformAction ', function(Event $event) {   Craft::log(" on delete ######\n\n", LogLevel::Info, true);  }); . Doesn't seem to work, I tried it with just 'onPerformAction' as well, it doesn't work then either.  

---

