I ran into this tonight.
I have a Page called Events. I have a custom Post Type called foo_event, and a custom taxonomy registerd to the custom post type called foo_event_taxonomy.
I worked my theme so that on the Events page I am getting a list of the custom post type foo_event. And in the sidebar I used the custom-taxonomies-menu-widget to output my foo_event_taxonomy menu.
However when clicking a taxonomy term I would land on a 404 despite having a taxonomy.php in place. I tried naming to taxonomy-foo_event_taxonomy.php but I still got a 404.
On each change I would visit the Permalinks page to flush the settings but to no avail.
I discovered what the problem was (even if I don’t understand it)
Both my custom post type and custom taxonomy registration functions specified a rewrite as
‘rewrite’ => array(‘slug’ => ‘events’, ‘with_front’ => false)
Note that the slug is the same as the existing Events Page slug, also events.
This seemed to be the cause – there is a clash going on with the existing page.
The requirement here is that the Page at /events/ lists all post type = foo_event and that clicking the post title loads /events/some-post, or /events/2011/06/some-post etc.. but IF the rewrite is using the same slug as the page this does not work.
I find this a little annoying. So I changed the rewrite rules for the custom type and the taxonomy to
‘rewrite’ => array(‘slug’ => ‘event’, ‘with_front’ => false)
‘rewrite’ => array(‘slug’ => ‘event’, ‘with_front’ => false)
Refreshed by visting Permalinks. And now the result is that if I click a post title I go to
/event/post-title
And this works, despite being illogical because really it should be /events/post-title
However, the taxonomy link /event/tag still does not work – 404.
So I then discovered you can’t have the same slug for the custom post as for the taxonomy either! Changed it to
‘rewrite’ => array(‘slug’ => ‘event2’, ‘with_front’ => false)
Refreshed at Permalinks, and now
/events/
/event/my-post
/event2/my-tag
All work. But it’s a real shame that the URLs are all completely illogical when all I want to do is move around under the logical space of /events/ – but WordPress cannot tell what you want from the same URL space I guess.
So then I had an idea which works … the slug can be whatever you want it to be – so I used
‘rewrite’ => array(‘slug’ => ‘events/view’, ‘with_front’ => false)
‘rewrite’ => array(‘slug’ => ‘events/tag’, ‘with_front’ => false)
And now my links are super and are within the /events space
/events/view/my-post
/events/tag/my-tag
Hope this helps – I’ve seen this issue all over the forums.