The same slug in multiple taxonomies

We have a project that uses several custom taxonomies, and we’re finding that the client wants to add the same term in several of them. While the first slug for Foo may be foo, subsequent copies of Foo in different taxonomies become foo-2.

It would be nicer if the two terms could both use the same slug. It would be less confusing, and allow for nicer URLs like search?tax=foo rather than search?tax=foo-2.

Read More

I notice that the wp_terms and wp_term_taxonomy table are separate, leading me to believe that it’s technically possible for the same term (Foo with the slug foo) to appear in more than one taxonomy. But this option isn’t exposed in the user interface. Is there a good reason for this? Would I be risking future brokenness by fiddling with the database like that?

Related posts

Leave a Reply

1 comment

  1. When you say keyword, do you mean term?

    I just did a quick test to confirm: I can have the same term, which has the same slug, in both the Category and Post Tag taxonomies, so I assume that custom taxonomies likewise can have terms with the same slug.

    So, might there be some taxonomy/term confusion happening here? The search?tax=foo seems to imply a search based on a taxonomy, rather than on a taxonomy term. A taxonomy term search would look like search?taxonomy=foo&term=bar, or perhaps search?term=bar.