Make WordPress Core

Opened 15 years ago

Closed 15 years ago

#10647 closed enhancement (fixed)

Add $force parameter to wp_delete_*() functions

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


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 15 years ago.

Download all attachments as: .zip

Change History (3)

15 years ago

#1 @TobiasBg
15 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.

#2 @scribu
15 years ago

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

Fixed in [12158].

Note: See TracTickets for help on using tickets.