[wp-trac] [WordPress Trac] #20645: 'delete_term' action doesn't pass the deleted term object
WordPress Trac
wp-trac at lists.automattic.com
Wed May 9 16:21:00 UTC 2012
#20645: 'delete_term' action doesn't pass the deleted term object
--------------------------+-----------------------------
Reporter: bigdawggi | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version:
Severity: normal | Keywords:
--------------------------+-----------------------------
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.).
--
Ticket URL: <http://core.trac.wordpress.org/ticket/20645>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list