Opened 11 years ago
Closed 11 years ago
#32933 closed enhancement (fixed)
Allow pre-delete bailout in `wp_delete_post()`
| Reported by: | boonebgorges | Owned by: | wonderboymusic |
|---|---|---|---|
| Priority: | normal | Milestone: | 4.4 |
| Component: | Posts, Post Types | Version: | |
| Severity: | normal | Keywords: | has-patch |
| Cc: | Focuses: |
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.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
In 34082: