[wp-trac] [WordPress Trac] #13060: Duplicate Term bug

WordPress Trac wp-trac at lists.automattic.com
Sun Apr 25 03:24:21 UTC 2010


#13060: Duplicate Term bug
--------------------------+-------------------------------------------------
 Reporter:  DeannaS       |       Owner:  dd32       
     Type:  defect (bug)  |      Status:  accepted   
 Priority:  normal        |   Milestone:  3.0        
Component:  Taxonomy      |     Version:  3.0        
 Severity:  normal        |    Keywords:  needs-patch
--------------------------+-------------------------------------------------
Changes (by dd32):

  * status:  assigned => accepted


Comment:

 > You'll end up with another row being added to the table to the left,
 exactly identical. The database is untouched. This is because
 wp_insert_term() returns an array (not WP_Error) when the
 term/slug/taxonomy combo already exists. admin-ajax.php doesn't account
 for that, either as a return value, or beforehand. (2.9 used
 category_exists, i.e. is_term...)

 This behaviour is the same in 2.9 for post tags, You add one that already
 exists, and you get an extra row added to the table, yet the database is
 untouched. Categories now suffer from it since it was merged into the same
 table.

 For both Categories and tags, 2.9 acted strangely when adding a new term
 with a slug, For example, if you had {{{ {slug => red, name => Red} }}} in
 the database already, and you added {{{ {slug => red, name => "Red Hats"}
 }}}, You'd loose the "Red Hats" name, and it'd re-use the "Red" name.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/13060#comment:4>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list