Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#54074 closed defect (bug) (wontfix)

Slug index not set as unique in databse

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

Description

Hi,

In the documentation (https://codex.wordpress.org/Database_Description#Table:_wp_terms) it is stated that the wp_terms slug column is unique but is not set as unique in the database. This will allow duplicate values.

Please fix.

Thanks.

Change History (3)

#1 @rixeo
3 years ago

I think its this way as there can be different terms with the same slug. The unique index is the term_id and the slug, not just the slug.

#2 @SergeyBiryukov
3 years ago

  • Component changed from General to Taxonomy
  • Keywords close added
  • Severity changed from critical to normal

#3 @peterwilsoncc
3 years ago

  • Focuses docs added; performance removed
  • Keywords close removed
  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed
  • Version changed from 5.8 to 4.1

As Sergey mentions above, this was an intentional change in WP 4.1 to allow different taxonomies to use the same slug, for example both a names taxonomy and a cities taxonomy could use the slug paris. The function wp_unique_term_slug() performs a check to ensure the slug is unique for each taxonomy.

I've updated the codex page to reflect this as it seems it was never updated.

I'm going to close this as wontfix, which is trac's unfriendly term to indicate no cahnge to code is required. I've added the docs focus as a change was required to the codex.

Note: See TracTickets for help on using tickets.