[wp-trac] [WordPress Trac] #29848: Caching problems when using 'alias_of' in wp_update_term() and wp_insert_term() (was: Cache is not flushed for term A when creating a new term with A as an alias)

WordPress Trac noreply at wordpress.org
Fri Oct 3 03:48:24 UTC 2014


#29848: Caching problems when using 'alias_of' in wp_update_term() and
wp_insert_term()
--------------------------+---------------------------
 Reporter:  boonebgorges  |       Owner:  boonebgorges
     Type:  defect (bug)  |      Status:  accepted
 Priority:  normal        |   Milestone:  4.1
Component:  Taxonomy      |     Version:
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |     Focuses:
--------------------------+---------------------------
Changes (by boonebgorges):

 * owner:   => boonebgorges
 * status:  new => accepted
 * severity:  minor => normal


Comment:

 There are actually a few bugs here, so let's do something more
 comprehensive. [attachment:29848.2.patch] does the following:

 * Give the same treatment to `wp_insert_term()` and `wp_update_term()`
 * Use `get_term_by( 'slug' )` instead of a direct DB query. Better because
 it's prettier, it'll hit the cache, it'll hit relevant filters, etc
 * Use `wp_update_term()` instead of a direct database query, so that we
 purge the cache
 * Remove the now redundant 'edit_terms' and 'edited_terms' hooks - they
 appear only in `wp_update_term()`
 * Unit tests for using 'alias_of' in both functions

--
Ticket URL: <https://core.trac.wordpress.org/ticket/29848#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list