[wp-trac] [WordPress Trac] #53613: Add filter to prevent term deletion

WordPress Trac noreply at wordpress.org
Tue Jul 6 21:32:41 UTC 2021


#53613: Add filter to prevent term deletion
----------------------------+-----------------------------
 Reporter:  davedoesthings  |      Owner:  (none)
     Type:  enhancement     |     Status:  new
 Priority:  normal          |  Milestone:  Awaiting Review
Component:  Taxonomy        |    Version:  trunk
 Severity:  normal          |   Keywords:  needs-patch
  Focuses:                  |
----------------------------+-----------------------------
 Currently, the developer UX for `wp_delete_term` is not ideal when
 attempting to prevent term deletion.

 In order to prevent a term from being deleted e.g. to implement
 "protected" terms, you must essentially throw a `wp_die()` call from
 within a `pre_delete_term` action callback.

 This isn't ideal, and isn't consistent with other, similar implementations
 such as the `pre_delete_post` filter in `wp_delete_post`.

 I propose that a filter should be introduced that fires before
 `pre_delete_term` and offers like-for-like functionality.

 Unfortunately, `pre_delete_term` -- the most appropriate name for this
 filter -- is already used by the action, therefore I propose
 `pre_term_deletion` or similar.

 I have a patch ready which will be attached shortly.

 Thanks,
 Dave

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/53613>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list