Can you use the same slug for a Post Type and Taxonomy?

Operapreneur
El Presidente
Friendly Neighbour

Member    Likes (0)

Hi!

I'm wondering if you can use the same slug and post name for a post type and taxonomy. I'd like visitors to be sent to the post-type if one exists and if it doesn't exist, they should be sent to the taxonomy.php page. I am testing it out and I get a 404 page when it should be sending the visitor to taxonomy.php.

My Example:
I'm using the same slug for a taxonomy called "directors" and a post-type called "directors." I have a list of directors at the end of a news article: Jane Doe, John Doe.

John Doe submitted information for our post-type "directors" so when visitors click on his name they go to the post-type at mysite.com/directors/john-doe

Jane Doe did not submit information so when visitors click on her name they go to the taxonomy.php mysite.com/directors/jane-doe

As I mentioned, when you click on Jane Doe I get a 404 page instead of a taxonomy.php page.

I've been searching for an answer but can seem to find it. Do I need to use a template_redirect?

Thanks!

WordPress Questions?

We've got answers!

  • 350+ Premium Plugins & Themes
  • 'Your WordPress Team' support
  • WordPress Nirvana from just $19

Find out more »