3

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.

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?

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.

  • Yes, I meant 'term' throughout. I didn't mean taxonomy=foo&term=bar, I meant my-taxonomy=foo. – Marcus Downing Jul 14 '11 at 15:08
  • I'm still confused. What is my-taxonomy=foo? – Chip Bennett Jul 14 '11 at 15:16
  • my-taxonomy is one of several custom taxonomies. foo is the slug of a term in that taxonomy. From my own tests, Wordpress doesn't accept the same slug to be used in multiple taxonomies, complaining that "The slug “foo” is already in use by another term " – Marcus Downing Jul 14 '11 at 15:19
  • I clearly didn't describe my question very well. I'll have a think about how better to rephrase it. – Marcus Downing Jul 15 '11 at 9:30
  • I know this is an old post, but... I see that it's not possible to have the same term (with the same slug) under a category and tag (or between any taxonomies). Was this change made in WordPress since you posted your answer? I asked a similar question today: wordpress.stackexchange.com/q/120096/10691 – its_me Oct 25 '13 at 17:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.