#12349 closed defect (bug) (fixed)
wp_insert_term doesn't check for already existing slugs if the slug is implicit
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 3.0 | Priority: | high |
Severity: | normal | Version: | |
Component: | Taxonomy | Keywords: | has-patch |
Focuses: | Cc: |
Description
Expected: even if the slug of the new term isn't explicitly provided, but generated from the term's name wp_insert_term()
should check if it already exists.
Actual: it doesn't. wp_insert_term()
checks for existing slug only of it has it explicitly given as an argument.
Attachments (2)
Change History (12)
#7
@
15 years ago
That check does prevent the user from doing really silly things with slugs. Like creating an "Apple" tag with "apple" slug and then creating an "Orange" tag with an "apple" slug (which will end up apple-2 and two tags with the same name will appear). Perhaps a better patch is to do the dupe check only if the provided slug does not match the slug generated from the name. This way people who fill in the slug to match the name won't get a dupe error.
Note: See
TracTickets for help on using
tickets.
I did that for a specific reason, At the time, I believe it was for back compat reasons. Its possible to have a Term in multiple taxonomies by having the name the same. (Ie. Create Tag "Test" and category "Test" and they'll both get 'test' slug, and the same TermID).
That branching selection, was to ensure that that was still possible if the slug was provided..
Personally.. I dont know why anyone would want that (to me) strange behaviour.