[wp-trac] [WordPress Trac] #30780: Inconsistent behavior/results of wp_insert_term and wp_update_term

WordPress Trac noreply at wordpress.org
Fri Dec 19 21:04:25 UTC 2014


#30780: Inconsistent behavior/results of wp_insert_term and wp_update_term
-------------------------+------------------
 Reporter:  ipm-frommen  |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  4.2
Component:  Taxonomy     |     Version:  4.1
 Severity:  normal       |  Resolution:
 Keywords:  has-patch    |     Focuses:
-------------------------+------------------

Comment (by ipm-frommen):

 Hi Boone,

 you're right with your assumption/observation. I happened to use a term
 that I already had inserted to another taxonomy. When moving this term to
 some parent, its slug will be generated using the parent's slug. If there
 is no other term with this slug - even in other taxonomies - then there's
 no problem (i.e., renaming of the slug).

 That being said, I was wondering what you meant by ''go with something
 more conservative (ie local to `wp_update_term()`)''. My addition to the
 `wp_unique_term_slug` function makes sense to me in '''any''' case. If
 there is no term with the same slug having the same parent, then there
 should be no need for generating a new slug (incorporating the parent
 term's slug). Or do I miss something here?

 The naming `wp_unique_term_slug`, however, does not fit anymore as it is
 sufficient to generate a slug that's unique in the given context (i.e.,
 either unique for a non-hierarchical taxonomy, or unique for a
 hierarchical taxonomy wrt. the term's parent). So far, I didn't come up
 with a more fitting name, though.

 Cheers,
 Thorsten

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


More information about the wp-trac mailing list