[wp-trac] [WordPress Trac] #32248: adding a term containing "&" and renamed

WordPress Trac noreply at wordpress.org
Mon May 4 16:20:29 UTC 2015


#32248: adding a term containing "&" and renamed
----------------------------+-----------------------------
 Reporter:  olivM           |      Owner:
     Type:  defect (bug)    |     Status:  new
 Priority:  normal          |  Milestone:  Awaiting Review
Component:  Administration  |    Version:  4.0
 Severity:  normal          |   Keywords:
  Focuses:  administration  |
----------------------------+-----------------------------
 when adding terms to a post, $_POST[tax_input][taxonomy] contains only the
 terms name.
 in edit_post() before sending $post_data to wp_update_post, we try to find
 each term by name ( via get_terms() )
    -> which wont work for term with '&' in name, as it's saved as html
 entities in wp_terms
 if not term is found, the term stays in post_data as a string for term's
 name

 then in wp_update_post, we use wp_set_object_terms, which will try to find
 the term via term_exists,
 but term_exists do a sanitize_title to try to get the term by slug
    -> which wont work if the slug has been changed after term creation.

 so finally, wp_set_object_terms will try to create the term, but it will
 failed with a "term with the name provided already exists in this
 taxonomy" error

 ( => and this will also stop adding other terms to the post )


 steps to reproduce the bug :
  - create a term "Bob Marley & the Wailers"
  - change the term slug from 'bob-marley-the-wailers' to 'bob-marley-and-
 the-wailers'
  - edit a post, add the term "Bob Marley & the Wailers"
  - submit
 => the term wont be added

--
Ticket URL: <https://core.trac.wordpress.org/ticket/32248>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list