I am building a website in WP where content (news, announcements, events) are grouped by regions (e.g london, nyc, ...; these are custom post types). In all the contents, I have a meta box where I can choose which region the content belongs to.

Everything works great in region pages because I am using WP_Query and query the region meta to equal the region CPT ID. However, I also have archive pages for news and events and I want to be able to somehow define the region in these pages. I am going to show you what I want through permalink structure as I think it makes the most sense:

My current structure is like this:

 /region/london -> Region Page
 /about -> About page (common)
 /about/structure -> Structure page (common)
 /regions/london -> About London (notice that regions is plural)
 /regions/nyc -> About NYC

 / -> Front page

I am trying to create a structure like this:

/london -> Region page
/london/news -> News Archive for London
/nyc/events -> Events Archive for London

/nyc -> Region Page
/nyc/news -> News Archive for NYC
/nyc/events -> Events Archive for NYC

/pages/about -> About page (common)
/pages/about/structure -> Structure page (common)
/pages/regions/london -> About London
/pages/regions/nyc -> About NYC

/ -> Front page

The common pages can be accessed from everywhere. Is it even possible to achieve this kind of structure in WP? If yes, what part of WP should I use to rewrite these URL structures. I would want to start simple and prefix all static pages, then try to remove prefix from region pages (custom post types), then try to prefix news and other post types (events, announcements) using regions and filter the posts using the prefix value.

My entire research on all the ways have been a failure as I cannot find any clue on how to do it.

I would also like to mention that, I do not want to change rewrite rules because that will break my WPML translations prefixes.

Your Answer

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

Browse other questions tagged or ask your own question.