[wp-trac] [WordPress Trac] #27966: wp_insert_term checking term with slug only without taxonomy

WordPress Trac noreply at wordpress.org
Tue Apr 22 09:09:12 UTC 2014


#27966: wp_insert_term checking term with slug only without taxonomy
--------------------------+-----------------------------
 Reporter:  aalakkad      |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Taxonomy      |    Version:
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 When the function `wp_insert_term` is called, it uses `term_exists`
 function to check for already existing terms.

 The problem is the `term_exists` function is called with 1 parameter (the
 slug parameter) without the taxonomy parameter.

 To emulate the problem, create 2 custom taxonomy, add a term to the first
 one, then add a new term to the second one with the same name and slug;
 then try editing one and the changes will be made on the other one too.

 You can find the line (in wp-includes/taxonomy.php)
 [https://core.trac.wordpress.org/browser/tags/3.9/src/wp-
 includes/taxonomy.php#L2430].

 To fix it just add the second parameter (taxonomy) to the `term_exists`
 function.

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


More information about the wp-trac mailing list