Is it possible to use one slug for Multiple Taxonomies?

I have a situation where i have a lot of tags and i want to add custom taxonomies to sort them. But the thing is when i register new taxonomy i cannot use tag slug.

Example (Tag Taxonomy)

example.com/tag/artist-name

Changed to (Artist Taxonomy)

example.com/tag/artist-name

As you can see, i want to change taxonomy while preserving permalinks. I want to list tags based on couple things. But tags are just tags there is no sorting by type with them. I should have used custom taxonomies from the beginning but its too late now.

If i change tags to new taxonomy it will look like this

example.com/artist/artist-name

And i will have a lot of 404 pages. How do i even redirect 1k pages? Especially since they are just part of the tags. I would really have to add redirects one by one.

2 Answers
2

You shouldn’t and most likely can’t achieve what you are looking for. The tag taxonomy term is reserved by WordPress itself, as well as a couple of other terms. Take a look into this page from the codex.

If you use the same slug for different taxonomies, that would defeat the purpose. For example, categories and tags are taxonomies themselves.

Imagine having two categories, /cat/ and /dog/, both pointing to /animals/. The WordPress itself won’t allow you to do that, but let’s say you do this by hacking the database. What should be shown when you visit /animals/ slug? cats or dogs?

The worse scenario is to even mix different taxonomy types. Then the WordPress can’t even decide what template file to use!

Unfortunately WordPress is not optimized to make this happen for you just by writing a simple rule. I myself had to redo a lot of works sometimes, just because i didn’t to it the proper way at the beginning. Your other option would be to write an SQL query or a plugin to alter the data for you and save it in a new format.

Even if you write some rewrite rules to achieve this, you will end up with a messed up website, random 404 pages and incorrect content output.

Leave a Comment