#15741 closed defect (bug) (fixed)
Taxonomy: Duplicate term slug error message refers to the name
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 3.8 | Priority: | normal |
Severity: | normal | Version: | 3.0.2 |
Component: | Taxonomy | Keywords: | has-patch commit |
Focuses: | Cc: |
Description
You can't create a term if there is another existing term with the same slug. The error message indicates this warning incorrectly, referring to the term "name" instead of "slug":
A term with the name provided already exists with this parent.
Problem in action:
- Create a category name "Example" with slug "example" without any parent category.
- Once that is saved, try creating the exact same category again.
- "A term with the name provided already exists with this parent." error shows up.
- Create a category name "Example" with slug "example-2".
- No error. Category with the same name can be created, contrary to the error message in step 3.
The error message should refer to the slug not name if this is an intended behavior. If the same term name should not exist under one level, step 4 should not be allowed either (especially with Tags).
Attachments (5)
Change History (20)
#4
@
14 years ago
- Keywords dev-feedback added; has-patch reporter-feedback removed
See also Line 1651 | Line 1972 (trunk). Seems like expected behaviour.
Wontfix?
#5
@
14 years ago
- Cc sheri@… added
I think the ticket intention is to change 'name' to 'slug' in the line below the comment that says "Same name, same slug."
#6
follow-up:
↓ 11
@
14 years ago
- Cc dimadin added
I was thinking should I open a new ticket for this, but lets stay here for now.
If you go to edit screen of existing term and try to edit slug (by changing it to one that is used by other term), you only get error "Item not updated" but you don't get reason why it wasn't updated.
There should be explanation as there is one when you use Quick Edit.
#7
@
12 years ago
- Keywords has-patch commit added; dev-feedback removed
Latest patch refreshes against trunk and updates the error message to:
"A term with the name and slug provided already exists."
This error message appears only when both the name _and_ slug match (there is different handling for when just the name or just the slug match) so this message makes the most logical sense and provides more information.
#9
follow-up:
↓ 10
@
12 years ago
15741.3.diff seems fine for tags.
This code for categories also runs when the slug already exists (tags/3.6/wp-includes/taxonomy.php#L2086), so we can change the string for categories too: 15741.4.diff.
However, it might be confusing if you don't specify a slug for the category, and it's auto-generated from the name.
15741.5.diff introduces a new string for maximum clarity.
#10
in reply to:
↑ 9
@
12 years ago
Replying to SergeyBiryukov:
15741.4.diff and 15741.5.diff both look solid!
#11
in reply to:
↑ 6
@
12 years ago
Replying to dimadin:
If you go to edit screen of existing term and try to edit slug (by changing it to one that is used by other term), you only get error "Item not updated" but you don't get reason why it wasn't updated.
There should be explanation as there is one when you use Quick Edit.
Related: #16243
#12
@
12 years ago
I'm fine with 15741.5.diff.
Devil's advocate: How necessary is "and slug"? This is merely an error message that can/should be supplied to the user. They'll only see it if both name and slug are the same, so if they change either, they won't get the error on second attempt. Consider the current text a simpler way of saying a more complex statement regarding a duplicate term. This is good QA but is it really something users run into? Is this honestly confusing for the user?
#14
@
11 years ago
- Owner set to nacin
- Resolution set to fixed
- Status changed from new to closed
In 26544:
#15
@
11 years ago
- Cc pavelevap@… added
In which circumstances can be string "A term with the name provided already exists with this parent." displayed? When the name is same, slug-2 is automatically generated and there is never any error. Or I am missing something? I can reopen or create new ticket, but maybe there is any possibility?
Based on the code around the diff, this looks inaccurate. Note fields => names, and the PHP comment.