Including two taxonomies in a permalink structure

I am trying to get my head around the permalink structures on WordPress sites, and I’m a bit stuck with what I’m trying to achieve:

My current permalink structure: /%category%/%postname%/

I have a custom-post type called ‘city’, and I want to create a structure like below:

mydomain.com/asia/china/beijing

So just to explain this structure:

asia – This is a term under a taxonomy called ‘continent’

china – This is a term under another taxonomy called ‘country’

beijing – This is the actual custom-post type post with title ‘Beijing’

So I basically have two taxonomies (continent and country) linking to my ‘city’ post type. So the way I see it, I need a structure like this:

mydomain.com/(taxonomy-continent)/(taxonomy-country)/(custom-post)

But I cannot seem to figure out how to achieve this with the permalink structure.

Any help would be greatly appreciated!

Thanks

1 Answer
1

You don’t need these two taxonomies. Just make your custom post type for places hierarchical and set countries and continents as parents. WordPress will build your permalinks then exactly as you want it.

After you’ve created the first post you get a selector for page parents from which you can choose:

enter image description here

Leave a Comment