Make WordPress Core

Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#29131 closed defect (bug) (duplicate)

Does not allow duplicate term slugs when using different cases

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

Description

Steps to reproduce:

  1. Go to Posts>Categories add new category with the name 'Banana'
  2. Go to Posts>Tags add new tag with the name 'BANANA'

This will result in a Category called Banana with the slug 'banana' and a Tag called 'BANANA' and the slug 'banana-2'.

Change History (7)

#1 @ocean90
10 years ago

  • Component changed from Rewrite Rules to Taxonomy
  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #22226.

See #5809.

#2 @jpswade
10 years ago

  • Resolution duplicate deleted
  • Status changed from closed to reopened

Please refer to the steps provided above then compare to the steps provided in issue #5809.

These are different issues, the issue here is specific to case, specifically when using all uppercase.

Last edited 10 years ago by jpswade (previous) (diff)

#3 @SergeyBiryukov
10 years ago

  • Keywords close added
  • Milestone set to Awaiting Review

This will result in a Category called Banana with the slug 'banana' and a Tag called 'BANANA' and the slug 'banana-2'.

This appears to be the expected result, see the description of wp_unique_term_slug().

The $slug has to be unique global to every taxonomy, meaning that one taxonomy term can't have a matching slug with another taxonomy term. Each slug has to be globally unique for every taxonomy.

The case of the term name doesn't matter.

We do create shared terms if there's an exact match (see #5809, #21950, #23199), but the plan is to get rid of them: http://make.wordpress.org/core/2013/07/28/potential-roadmap-for-taxonomy-meta-and-post-relationships/.

#4 @jpswade
10 years ago

Try this:

  1. Go to Post>Category (/wp-admin/edit-tags.php?taxonomy=category)
  2. In the 'Name' field enter: Banana
  3. Press "Add New Category" button
  4. Go to Post>Tag (/wp-admin/edit-tags.php?taxonomy=post_tag)
  5. In the 'Name' field enter: Banana
  6. Press "Add New Tag" button
  7. Observe the 'Slug' is 'banana'
  8. Delete the tag 'Banana'
  9. Go to Post>Tag (/wp-admin/edit-tags.php?taxonomy=post_tag)
  10. In the 'Name' field enter: BANANA
  11. Press "Add New Tag" button
  12. Observe that the 'Slug' for the 'BANANA' Tag is 'banana-2'

The case of the term does seem to matter as the results are different.

#5 @SergeyBiryukov
10 years ago

In steps 1 to 7, you get a shared term, which we're going to fix in #5809 and #21950.

In steps 8 to 12, you get a separate term, which would be an expected result.

#6 @jpswade
10 years ago

  • Resolution set to duplicate
  • Status changed from reopened to closed

Duplicate of #5809.

I see that now, however this raises more questions than it does answer them...

#7 @ocean90
10 years ago

  • Keywords close removed
  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.