Opened 8 months ago
Last modified 8 months ago
#60532 new enhancement
Add a `pre_set_object_terms` action
Reported by: | davidbaumwald | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | 6.5 |
Component: | Taxonomy | Keywords: | good-first-bug has-patch |
Focuses: | Cc: |
Description
Working with some custom terms & taxonomies, and it looks like there's no way to hook in to wp_set_object_terms
_before_ the terms are updated.
In the end, the $old_tt_ids
is passed to the set_object_terms
action(added in r12261). But, these are the term_taxonomy_id
s and a a bit harder to work with than the plain terms. Also, these are provided _after_ the terms are updated. So, there's no way to short-circuit the updating.
However, I think it would be useful to have a pre_
action that can work on the current terms before commiting the changes.
Attachments (1)
Change History (3)
Note: See
TracTickets for help on using
tickets.
This commit adds a new action hook, 'pre_set_object_terms', to the wp_set_object_terms function. This hook fires before an object's terms are set, allowing developers to perform operations or modifications on the terms array before the changes are committed.