[wp-trac] Re: [WordPress Trac] #9397: Quick edit creates new tag from existing tag name

WordPress Trac wp-trac at lists.automattic.com
Thu Apr 30 21:16:11 GMT 2009


#9397: Quick edit creates new tag from existing tag name
--------------------------+-------------------------------------------------
 Reporter:  forposts      |        Owner:  ryan   
     Type:  defect (bug)  |       Status:  closed 
 Priority:  normal        |    Milestone:  2.8    
Component:  Quick Edit    |      Version:  2.7.1  
 Severity:  normal        |   Resolution:  wontfix
 Keywords:                |  
--------------------------+-------------------------------------------------
Changes (by hakre):

  * keywords:  needs-patch =>
  * status:  new => closed
  * resolution:  => wontfix


Comment:

 Quickedit uses (via 4 or 5 other functions) wp_set_object_terms() with an
 $append=false. Read yourself:

 {{{
 * @param array|int|string $term The slug or id of the term, will replace
 all existing
 * related terms in this taxonomy.
 }}}

 Actually passed is an array that contains the names, not slugs, not ids.

 First all ids for the post are pulled. ids are numbers, not the names nor
 slugs.

 Then the passed names (not slugs) as terms are passed one by one to
 is_term() which tries to find out by slug or name. that function mainly is
 for forming two sql queries who should look up for a particular tag by
 name or slug.

 that function then calls sanitize_title() which replaces spaces. therefore
 the ones named tag has been converted to slug. but that is only slug by
 accident because the correct slug of 'tag2 name' is 'tag2' not
 'tag2-name'.

 because a tag with the slug 'tag2-name' can not be found, it will be
 inserted with the appropriate name ('tag2 name'). this is why a new tag is
 added. that tag will be discovered (new id) and the one with the old id
 won't be discovered any longer and therefore removed ($append = false).


 '''how to patch?'''

 I have no Idea. This is all so mixed up, something sanitzed here,
 something re-interpreted there. I doubt touching any of these functions is
 really promising.

 i therefore set this to wontfix. feel free to provide a solution/patch and
 reopen then.

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


More information about the wp-trac mailing list