WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#30127 closed enhancement (fixed)

Add `before_delete_term` action

Reported by: cmmarslender Owned by: boonebgorges
Milestone: 4.1 Priority: normal
Severity: normal Version: 4.1
Component: Taxonomy Keywords: has-patch
Focuses: Cc:
PR Number:

Description

Sometimes, the need arises to hook in to wp_delete_term, and take some action before the terms are actually deleted. Currently, there are only actions that fire after changes are already made in the database (term gone, posts already updated, etc). Would be really helpful to be able to hook into this process before any changes are made.

Patch attached with proposed addition.

Attachments (1)

30127.diff (665 bytes) - added by cmmarslender 5 years ago.

Download all attachments as: .zip

Change History (6)

@cmmarslender
5 years ago

#1 @cmmarslender
5 years ago

  • Keywords has-patch added

#2 @lancewillett
5 years ago

Patch looks good to me.

#3 @boonebgorges
5 years ago

  • Milestone changed from Awaiting Review to 4.1

#4 @boonebgorges
5 years ago

'pre_' is much a much more common convention for this sort of hook in WP. We do have 'before_delete_post', but I think that's just a very old hook.

#5 @boonebgorges
5 years ago

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

In 30088:

Introduce 'pre_delete_term' hook.

Props cmmarslender.
Fixes #30127.

Note: See TracTickets for help on using tickets.