Opened 4 years ago

Closed 4 years ago

#10647 closed enhancement (fixed)

Add $force parameter to wp_delete_*() functions

Reported by: scribu Owned by: scribu
Priority: normal Milestone: 2.9
Component: General Version: 2.9
Severity: normal Keywords: has-patch
Cc:

Description

With the new trash functionality, there is no way to delete a post or attachment directly. You have to call the function two times.

Both wp_delete_post() and wp_delete_attachment should have an optional $force parameter that bypasses the trash.

Attachments (1)

post.patch (1.6 KB) - added by scribu 4 years ago.

Download all attachments as: .zip

Change History (3)

scribu4 years ago

I believe line 1148

 return wp_delete_attachment($postid);

should become

 return wp_delete_attachment($postid, $force);

so that using wp_delete_post on an attachment maintains its behavior. Without this change a call of wp_delete_post (with force) on an attachment would move it to trash instead.

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

Fixed in [12158].

Note: See TracTickets for help on using tickets.