Ticket #3683 (closed defect (bug): fixed)

Opened 2 years ago

Last modified 1 year ago

It is possible to create multiple categories with the same name and same slug

Reported by: johnbillion Assigned to: rob1n
Priority: normal Milestone: 2.3
Component: Administration Version: 2.1
Severity: normal Keywords: dev-feedback 2nd-opinion
Cc:

Description

This is a trivial one, I know.

It is possible to create multiple categories with the same name and/or same slug, and doing so breaks all concerned categories.

To recreate:

1. Go to Manage -> Categories in the admin panel.

2. Create a new category.

3. Create another category with the same name and/or same slug.

4. Place some posts into these categories (so they show up on the blog) and then attempt to browse one of the categories via the blog. A 404 Not Found error is returned on all categories concerned.

=================

Desired Behaviour:

Either the user is alerted that they are attempting to create a duplicate category, or the duplicate category is created with a numerical suffix on the slug (eg. articles-2) much the same as is done with multiple blog posts that have the same titles.

IMO the first option would be preferable.

Change History

01/26/07 05:36:43 changed by johnbillion

  • severity changed from trivial to minor.

01/26/07 06:54:13 changed by foolswisdom

  • priority changed from lowest to high.
  • severity changed from minor to major.
  • milestone set to 2.1.1.

johnbillion, thank you for the excellent bug reports!

Raising severity because not supposed to be able to create duplicate categories.

02/21/07 15:10:49 changed by Nazgul

  • milestone changed from 2.1.1 to 2.1.2.

2.1.1 is out, so bumping the milestone to 2.1.2.

02/24/07 06:03:36 changed by johnbillion

Anyone have an opinion on the desired behaviour in this situation? It might spur someone on to write a patch if a decision about the desired behaviour is made. (I'd do it myself, alas I'm not familiar enough yet with WordPress.)

03/18/07 01:54:17 changed by rob1n

  • owner changed from anonymous to rob1n.
  • status changed from new to assigned.
  • milestone changed from 2.1.3 to 2.2.

I'd say this should be fixed. It's expected behavior, and things go haywire if two categories have the same slugs.

But then again, why would you create categories with the same name and or slug? But then again, we should have a safeguard... never know what those pesky users can do >.<.

03/18/07 01:54:35 changed by rob1n

Also, changing milestone to 2.2 as this isn't a critical fix.

03/20/07 03:56:51 changed by rob1n

See also #1956. Though I don't think we should transparently change the URL -- we should change the slug in the first place.

03/20/07 03:57:01 changed by rob1n

  • keywords changed from categories to dev-feedback 2nd-opinion.

03/21/07 06:50:43 changed by charleshooper

+1 on alerting the user. I feel that if a user tries to create a category with a specific slug the user should be alerted instead of us just silently changing the slug.

However it might also make sense to have WP change the slug on its own and then alert the user that such a change was made.

03/21/07 06:56:34 changed by majelbstoat

The post slug is silently changed if that clashes, so this wouldn't be all that unexpected.

03/24/07 23:59:32 changed by ryan

Category hierarchies need to be taken into account. Two categories named "Bar" are different if the y have different parents. /bar is not /foo/bar.

03/27/07 19:58:47 changed by foolswisdom

  • milestone changed from 2.2 to 2.3.

04/11/07 21:13:28 changed by jhodgdon

As of [5243], the behavior has been changed (I think it actually changed in [5148]).

Currently, what happens is that if you try to add a category with the same slug as an existing category, the code treats it as an update on the original category. However, on the screen it still says "added category abc", which is incorrect since all that happened was it updated existing category abc.

But anyway it is now impossible to add a category with the same slug as an existing category. Same name is still possible, but shouldn't cause any major difficulties (I tested this and didn't see any problems).

In my opinion, however, the existing behavior is undesirable.

04/25/07 02:32:13 changed by rob1n

  • status changed from assigned to new.

04/29/07 20:29:04 changed by rob1n

  • priority changed from high to normal.
  • severity changed from major to normal.

09/22/07 06:18:01 changed by markjaquith

  • status changed from new to closed.
  • resolution set to fixed.

It's now not possible to add a category with the same slug.