'delete_term' action doesn't pass the deleted term object
|Reported by:||bigdawggi||Owned by:||ryan|
The 'delete_term' action passes 3 params ($term, $tt_id, $taxonomy), just like the 'create_term' action. The issue is that the $term passed to 'delete_term' is not a term object, but instead the term ID; and the issue with that, is there's no longer a way to have anything that hooks on this 'delete_term' action reference information about the term while it was still around.
My use case:
I hooked on 'create_term' to perform actions based on the properties of the $term object. On 'delete_term' I needed to access those properties to perform respective actions counting on $term to be an object (as mentioned in the DocBlock)
* @uses do_action() Calls both 'delete_term' and 'delete_$taxonomy' action * hooks, passing term object, term id. 'delete_term' gets an additional * parameter with the $taxonomy parameter.
The $term passed to 'delete_term' action was not an object, but instead the ID for the term (which doesn't help b/c the term's deleted and I can't look it up anymore at the point of the action).
The attached patch stores the deleted $term object prior to the actual deletion of the term, and passes it through to the following actions so they can utilize the old properties of the term. (e.g., slug, name, etc.).
Change History (10)
comment:4 SergeyBiryukov — 14 months ago
- Component changed from General to Taxonomy
- Keywords has-patch 3.5-early added
- Milestone changed from Awaiting Review to Future Release
comment:6 in reply to: ↑ 5 SergeyBiryukov — 12 months ago
- Keywords 3.5-early removed
- Milestone changed from Future Release to 3.5
- Owner set to ryan
- Resolution set to fixed
- Status changed from new to closed