Make WordPress Core

Opened 11 years ago

Closed 11 years ago

#8909 closed defect (bug) (fixed)

Make delete_attachment action hook helpful

Reported by: filosofo Owned by:
Milestone: 2.8 Priority: normal
Severity: normal Version: 2.8
Component: General Keywords: delete_attachment has-patch
Focuses: Cc:
PR Number:


Similar to the situation with delete_user, the delete_attachment action hook fires off too late to be of much use: at that point the attachment and all of its data have been deleted.

People have complained about this here and here.

I grepped through the plugin repository, and of about 6200 plugins, only 5 use the delete_attachment hook: audit-trail, karailievs-sitemap, lumberjack, power-thumbnail, vivtiger-image-resizer. (One other one---scissors---complains in a comment about the fact that the hook can't be used at that point).

Of those plugins that use delete_attachment, it appears that none would be adversely affected by my patch. In fact, at least one (vivtiger-image-resizer) has a conditional block based on getting back post information from the id passed to the callback, something that currently cannot happen, so my patch should apparently keep it from having orphaned thumbnails.

Attachments (1)

delete_attachment.diff (594 bytes) - added by filosofo 11 years ago.

Download all attachments as: .zip

Change History (2)

#1 @ryan
11 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [10400]) Move delete_attachment action up. Props filosofo. fixes #8909

Note: See TracTickets for help on using tickets.