[wp-trac] [WordPress Trac] #45075: wp_delete_attachment() has unreliable return and wrong process order

WordPress Trac noreply at wordpress.org
Mon Apr 15 22:36:10 UTC 2019

#45075: wp_delete_attachment() has unreliable return and wrong process order
 Reporter:  jave.web      |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Future Release
Component:  Media         |     Version:
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
Changes (by joemcgill):

 * severity:  critical => normal
 * milestone:  Awaiting Review => Future Release


 Hi @javeweb, thanks for the detailed report and investigation into the
 logic chain here.

 > wp_delete_attachment_files() should be called first - what is the point
 of deleting object and it's relations when physical data could not be

 Deleting files as the last stage in the process seems to be intentional,
 since the first time this is called, the attachment post is moved to the
 trash instead of deleted. We might consider returning an error if there
 was an error with deleting the file, but at that point the post will
 already be gone from the database, so the file will need to be manually

 In terms of severity, this is not a major breakage from previous behavior,
 so I don't see this being a critical bug. What's more important would be
 to see cases where deletion fails and fix those issues specifically.

Ticket URL: <https://core.trac.wordpress.org/ticket/45075#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list