WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 4 years ago

#10647 closed enhancement (fixed)

Add $force parameter to wp_delete_*() functions

Reported by: scribu Owned by: scribu
Milestone: 2.9 Priority: normal
Severity: normal Version: 2.9
Component: General Keywords: has-patch
Focuses: 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 5 years ago.

Download all attachments as: .zip

Change History (3)

scribu5 years ago

comment:1 TobiasBg5 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.

comment:2 scribu4 years ago

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

Fixed in [12158].

Note: See TracTickets for help on using tickets.