I am working on a site for a client and am using a plugin that adds an "event" custom post type and an "event-category" taxonomy.
I have also attached the "event-category" taxonomy to the default Wordpress "post" post type using the register_taxonomy_for_object_type function.
Now I have the following working URL scheme:
- Post are accessed using the URL structure site-name.com/article/post-slug
- Events are accesed using the URL structure site-name.com/event/event-slug
- Event category term archives have the URL structure site-name.com/events/event-category-slug
I made the event category term archives display only events by using a pre_get_posts action with the following code:
if (!$query->is_admin() && $query->is_main_query() && is_tax('event-category')) {
$query->set('post_type', 'event');
}
My problem is that I want to also have category archive pages that show only posts.
If possible these would ideally be accessed with the URL site-name.com/articles/event-category-slug
But if that's not possible it would be OK to have a different URL, as long as it leads to a page listing just posts in that particular event category.
Any help with the rewrite rules needed to achieve this would be greatly appreciated. I've found some articles that describe similar problems but I haven't been able to make them work for me.