#31617 closed defect (bug) (duplicate)
Adding new term is not checking uniqueness of slug
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.1 |
Component: | Taxonomy | Keywords: | |
Focuses: | Cc: |
Description
I'm able to register several NEW terms in various taxonomies with the same slug.
When I try to edit it by quick edit, or full edit validation works correctly, this is only when registering new terms in different taxonomies with the same slug.
When try to register new term with slug which is already existing in the same taxonomy, validation also works correctly.
Steps to reproduce:
- Open two Add new term forms for different taxonomy
- Add term in first taxonomy
- Add the same term in second taxonomy
- Notice, both are created with the same slug without any prompt
- Pick one of them and in quick edit change slug to different
- Try to go back with slug name to the same as in other taxonomy - proper prompt that name is already in use will be shown
- Notice that at point 7 you are not able to create duplicated slug name, but on point 3 you achieved this in other way
- Just for fun, you can add 3th term with same slug in 3th taxonomy :)
Change History (5)
#1
@
10 years ago
- Milestone Awaiting Review deleted
- Resolution set to duplicate
- Status changed from new to closed
#2
follow-up:
↓ 3
@
10 years ago
Thank you for a quick reply, I understand that it could be a feature, but I didn't seen it on release notes. I was so used to fact that term slugs are quique, that I threated is as bug automatically. I will need to adjust my applications now. As I understand from linked tickets, this also will be possible to set the same slug for different taxonomies when editing old term, notonly adding new one? In 4.1 it is still not working perfectly.
#3
in reply to:
↑ 2
@
10 years ago
Replying to gjaworek:
Thank you for a quick reply, I understand that it could be a feature, but I didn't seen it on release notes. I was so used to fact that term slugs are quique, that I threated is as bug automatically. I will need to adjust my applications now. As I understand from linked tickets, this also will be possible to set the same slug for different taxonomies when editing old term, notonly adding new one? In 4.1 it is still not working perfectly.
You'll only need to adjust it in your applications if you are using custom SQL queries to fetch terms, and depending on the uniqueness of slugs to do so. Everywhere in the WP API (see functions like get_term()
), a $taxonomy
parameter is required, which means that the ability to have slugs duplicated in different taxonomies should not cause any issues. There will be some related changes in WP 4.2 that *might* affect your custom applications - see https://make.wordpress.org/core/2015/02/16/taxonomy-term-splitting-in-4-2-a-developer-guide/ for more information.
As noted in my previous comment, the ability to set the same slug for different taxonomies when editing is fixed in 4.1.1, which has already been released, as well as 4.2.
Thanks for the report, gjaworek.
The ability to create terms with duplicate slugs in different taxonomies is a feature (introduced in 4.1), not a bug. See #21950, #5809. In 4.1, there was indeed a bug that prevented terms from properly being updated to have existing slugs. This will be fixed for 4.2 [30985] and was also fixed for 4.1.1 [31378]. See #30780.