Make WordPress Core

Opened 10 years ago

Closed 10 years ago

Last modified 3 years ago

#27966 closed defect (bug) (duplicate)

wp_insert_term checking term with slug only without taxonomy

Reported by: aalakkad's profile aalakkad Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Taxonomy Keywords:
Focuses: Cc:


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)

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

Change History (4)

#1 @aalakkad
10 years ago

To fix it, change line 2430 in (wp-includes/taxonomy.php) to:

        if ( $term_id = term_exists($slug, $taxonomy) ) {

#2 @helen
10 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

There's more to this whole shared terms thing than that - see a proposed roadmap here:

Closing this as a duplicate of #5809.

This ticket was mentioned in Slack in #core-js by adamsilverstein. View the logs.

3 years ago

This ticket was mentioned in Slack in #core-js by leewillis77. View the logs.

3 years ago

Note: See TracTickets for help on using tickets.