You need to use %cities%
(matching the name of the taxonomy).
I thought that %city% was just a placeholder with a random name.
Not quite – it’s called a permalink structure (permastruct) and is used to map to a regular expression. When you call register_taxonomy
, it automatically registers a new permastruct with the same name as the taxonomy.
Read up on WP_Rewrite::add_permastruct
which hopefully gives a bit more insight.
Update: Let’s clarify what we’re aiming for:
/city/new-york/events/
– Allevents
posts attached tonew-york
/city/new-york/restaurants/
– Allrestaurants
posts attached tonew-york
/city/new-york/events/foobar/
– Singleevents
“foobar”
And do you need hierarchical slugs for cities
? i.e. england/london
(answering “yes” is going to make things difficult). Or is london
sufficient?
Update 2: How about?
/events/new-york/
– Allevents
posts attached tonew-york
/restaurants/new-york/
– Allrestaurants
posts attached tonew-york
/restaurants/new-york/foobar/
– Singleevents
“foobar”