Including two taxonomies in a permalink structure

The question:

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:

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:

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

Any help would be greatly appreciated!


The Solutions:

Below are the methods you can try. The first solution is probably the best. Try others if the first one doesn’t work. Senior developers aren’t just copying/pasting – they read the methods carefully & apply them wisely to each case.

Method 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

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Comment