WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#13119 closed defect (bug) (fixed)

Duplicate slug not possible for separate items

Reported by: solostream Owned by: dd32
Milestone: 3.0 Priority: normal
Severity: blocker Version: 3.0
Component: Permalinks Keywords: dev-feedback
Focuses: Cc:

Description

I have recently come across a bug in WordPress 3.0-beta1 that has happened on two customers' sites. Apparently it is not possible to have the same term for an item be used twice, unlike previous versions. For instance, if you wanted to have a category slug named 'featured' and a tag named 'featured' it is not possible to do so. The first item that was created is assigned the slug 'featured' while the second one is assigned the slug 'featured-2'. This doesn't play nicely with our themes as the tag 'featured' needs to be used for a featured slider.

Steps to consistently reproduce the problem:

  1. Add a category called 'featured'. Leave all other fields blank.
  1. Add a tag called 'featured'. Again, leave all other fields blank.
  1. Look at tag slug -- it will be 'featured-2' instead of 'featured'
  1. Repeat steps 1-3 for another category/tag name to see same results

The above bug is not related to any plugins or theme being used. It is a part of WP Admin and needs to be corrected.

How to fix:

  • Like previous versions of WordPress, allow the ability to have two separate items to share the same slug (e.g., category and tag)

Attachments (1)

13119.diff (999 bytes) - added by ryan 5 years ago.
Look for siblings only if existing term is in the same taxonomy

Download all attachments as: .zip

Change History (26)

comment:1 follow-up: @scribu5 years ago

See #10712

comment:2 in reply to: ↑ 1 @solostream5 years ago

Replying to scribu:

See #10712

Thanks for the response, but it doesn't look like the bug you mentioned is the same thing. What I noticed is that the "-2" is appended to the slug if the same name is being used by another item, whereas issue #10712 is related to the parent category name being a part of the sub-category title.

In addition, the particular issue I submitted does not affect previous WordPress versions, including the latest stable release (2.9.2). It is only an issue when 3.0-beta1 is used, which for whatever reason is the version some hosts are upgrading their customers to for their blogs.

comment:3 @scribu5 years ago

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

Right, then it's a duplicate of #12911

comment:4 @scribu5 years ago

  • Milestone set to 3.0
  • Resolution duplicate deleted
  • Status changed from closed to reopened

I take that back.

It is however caused by this changeset: [13087]

comment:5 @scribu5 years ago

  • Owner set to dd32
  • Status changed from reopened to assigned

comment:6 @solostream5 years ago

@scribu

Thanks for the additional info and assigning this to dd32.

comment:7 @t31os_5 years ago

  • Cc wp-t31os@… added

comment:8 @blepoxp5 years ago

  • Component changed from Administration to Permalinks
  • Keywords dev-feedback added; category tag duplicate item term removed

Does this behavior need to be reverted or is it working the way it was intended to work?

comment:9 @ryan5 years ago

  • Severity changed from major to blocker

Terms in different taxonomies should be able to share a slug. That's the whole point of having canonical terms.

comment:10 @ryan5 years ago

That said, I can't reproduce this problem with current trunk. Tag and Category map to the same term_id with the same slug. Can anyone else reproduce this?

comment:11 @scribu5 years ago

Can't reproduce either (with and without MU enabled).

comment:12 @ryan5 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

comment:13 @t31os_5 years ago

I can reproduce this using tags and categories, or using a custom taxonomy, as long as a category exists with a given term slug i cannot create any new terms under any taxonomy using that same slug.

A term with the slug provided already exists.

Is all i see, i don't even get the appended terms, ie. term-2, term-3, etc..

comment:14 @nacin5 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

comment:15 @ryan5 years ago

t31os_, what version of 3.0? Detailed steps to reproduce?

comment:16 @t31os_5 years ago

Version - 3.0 Rev 14772 (current at time of writing)

Choose a category, any you have existing, mine had posts (not sure that matters), open up a term management page for any taxonomy, category, tag or a custom one, and attempt to create a term with a slug that matches that of the existing one.

In my case, i have around 25 random categories(test environment) and the category is called "Assigned" with a slug of "assigned" ..

I've even tested a term under a Page taxonomy and still received the previously mentioned duplicate term message.

Multisite is not enabled on my installation.

Have been running SVN(this install started at 3.0 though) for a while, but i can wipe and start clean if you'd like me to test from a clean install.

comment:17 @t31os_5 years ago

Sorry i've just realised my error, been reading those duplicate term tickets too much recently and realised i've tacked onto a permalink component ticket, apologies, this is a misplaced report.

Disregard, and i'll respond in the appropriate tickets (multi-tasking too many things and didn't spot the oversight till now).

Apologies all.

comment:18 @scribu5 years ago

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

comment:19 @nacin5 years ago

I could reproduce this but only that the UI behavior is different between 2.9 and 3.0.

  1. Create a category with the name "Category" and slug "term".

2a. Create a tag with the name "term" and don't provide a slug. In 3.0, you get "term-2" as a slug.

2b. Create a tag with the name "term" and slug "term." You'll get an error in 3.0.

In both cases in 2.9, a row with the name "Category" and slug "term" gets added to the grid, which obviously goes away on refresh as it never existed, that's only what we returned via AJAX however.

comment:20 @ryan5 years ago

If you create a tag and then a category with the same name, the category will get -2. If you create a category and then a tag, both get the same slug and ID.

comment:21 @ryan5 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

comment:22 @ryan5 years ago

See also #12349

@ryan5 years ago

Look for siblings only if existing term is in the same taxonomy

comment:23 @ryan5 years ago

(In [14783]) Check for siblings only if term already exists in the same taxonomy. see #13119

comment:24 @ryan5 years ago

See also #13060 and #13481

comment:25 @ryan5 years ago

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

Resolving as fixed. Please test and re-open if problems persist.

Note: See TracTickets for help on using tickets.