Opened 9 years ago
Closed 9 years ago
#32933 closed enhancement (fixed)
Allow pre-delete bailout in `wp_delete_post()`
Reported by: | boonebgorges | Owned by: | wonderboymusic |
---|---|---|---|
Milestone: | 4.4 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Posts, Post Types | Keywords: | has-patch |
Focuses: | Cc: |
Description
I've worked on a number of custom projects where post deletion is a resource-intensive process - such as when posts are arranged hierarchically, and deleting an item deletes the entire tree. In these cases, I've written custom delete routines that create a queue and then delete from the queue in batches. This generally works OK.
The problem is that when an item is queued for batch deletion, I want to prevent its deletion in other contexts: specifically, bulk actions on edit.php and Empty Trash. Currently, there's no way to do this, short of intercepting and modifying $_REQUEST
.
It'd be nice if there was a way to bail out of post deletion, no matter which interface is the origin of the deletion. The attached patch suggests one way, modeled on the *_metadata()
'pre_' filters.
In 34082: