Opened 5 years ago
#50229 new defect (bug)
slugs aren't allowed as long as they're in different taxonomies.
Reported by: | trasweb | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | 5.4.1 |
Component: | Taxonomy | Keywords: | |
Focuses: | Cc: |
Description
Hello,
I write relative to a bug in taxonomies. From [WP 4.1, duplicate slugs are allowed as long as they're in different taxonomies](https://core.trac.wordpress.org/browser/tags/5.4/src/wp-includes/taxonomy.php#L2710). However, this isn't currently so.
Example:
Taxonomy one with two terms: "one1", "one1-2". Both are slug.
Taxonomy two with a term: "one1"( slug )
- I create term with slug 'one1'.
- Checking of duplicated slug is in [
wp_unique_term_slug
]( https://core.trac.wordpress.org/browser/tags/5.4/src/wp-includes/taxonomy.php#L2710 ) - [
if
is true](https://core.trac.wordpress.org/browser/tags/5.4/src/wp-includes/taxonomy.php#L2711), so thatneeds_suffix
is true. - Query result of [line 2758](https://core.trac.wordpress.org/browser/tags/5.4/src/wp-includes/taxonomy.php#L2758) is a row( 'one1' of Taxonomy two )
- one1-2 is
$alt-slug
in [L2764](https://core.trac.wordpress.org/browser/tags/5.4/src/wp-includes/taxonomy.php#L2764) - Finally, query in [L2766](https://core.trac.wordpress.org/browser/tags/5.4/src/wp-includes/taxonomy.php#L2766) returns a row( "one1-2" of Taxonomy 1 ).
Conclusion: same slug with two different taxonomies aren't allowed.
Maybe, queries in this method, should be replaced with get_term_by
in order to check also taxonomy.
Regards
Manuel Canga
Note: See
TracTickets for help on using
tickets.