[wp-trac] Re: [WordPress Trac] #9397: Quick edit creates new tag from existing tag-name (was: Quick edit creates new tag from existing tag-name sanitizing to a new tag-slug taking over the existing tag-name as name for the new tag.)

WordPress Trac wp-trac at lists.automattic.com
Fri May 1 18:02:08 GMT 2009


#9397: Quick edit creates new tag from existing tag-name
------------------------------------------------+---------------------------
 Reporter:  forposts                            |        Owner:  ryan 
     Type:  defect (bug)                        |       Status:  new  
 Priority:  high                                |    Milestone:  2.8  
Component:  Taxonomy                            |      Version:  2.7.1
 Severity:  critical                            |   Resolution:       
 Keywords:  has-patch tag quick edit duplicity  |  
------------------------------------------------+---------------------------
Changes (by jhodgdon):

  * keywords:  needs-patch 2nd-opinion probably-wontfix tag quick edit =>
               has-patch tag quick edit duplicity
  * owner:  jhodgdon => ryan
  * status:  assigned => new


Comment:

 All that worry. It turns out the reason this bug was happening was that
 somewhere in WP it assumed there were no spaces in the tags field, but the
 tags field had spaces.

 So when the quick edit went to be saved, WP was exploding on commas, and
 the 2nd and subsequent terms started with spaces.

 When WP then tried to find the tags in the DB to see if they already
 existed, the name with a leading space didn't match the name in the DB.
 Ergo, must be a new term.

 The patch I just added simply trims the term name before trying to find it
 in the DB. I don't think this is a bad idea ever. Terms shouldn't start or
 end with spaces, and I think that when WP creates new terms, the spaces
 get stripped anyway. Not sure about that? Anyway, this fixes the problem.
 No more duplicate tags on quick edit.

 Also, just as a note, the Quick Edit stuff that saves the tags is going
 through the same code as full Post Edit. So the fix to #6593 that I posted
 a few minutes back also fixes apostrophe issues here that probably
 existed.

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


More information about the wp-trac mailing list