[wp-trac] [WordPress Trac] #29911: Deleting a term does not invalidate cache for child terms
WordPress Trac
noreply at wordpress.org
Thu Oct 9 18:29:48 UTC 2014
#29911: Deleting a term does not invalidate cache for child terms
--------------------------+----------------------------------------
Reporter: boonebgorges | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Future Release
Component: Taxonomy | Version:
Severity: normal | Keywords: needs-patch good-first-bug
Focuses: |
--------------------------+----------------------------------------
See #29614.
Steps to reproduce:
1. Create a $term in a hierarchical taxonomy
2. Create a $child_term with parent=$term
3. wp_delete_term( $term )
4. Fetch cached version of $child_term with get_term(). 'parent' is still
$term.
Unit test attached.
Two options to fix:
1. During deletion, run a query to get term_ids of all child terms, then
run each through `clean_term_cache()`.
2. During deletion, instead of doing a direct DB query to change the
parent, run each item through `wp_update_term()`.
Option 2 is much more aesthetically pleasing, but in cases where a parent
has hundreds of children, there could be scaling issues, as separate DB
queries would be run for each. Could use some testing, and a patch.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/29911>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list