I am working on a travel site, and there is a CPT called Listings with a taxonomy called Destinations.
The Destinations taxonomy is hierarchical and looks like this:
We have another taxonomy called Categories that contains the categories of listings, such as Restaurants, Parks, Beaches, etc.
What we want to do is programmatically create a sub-page under each City for each Category that the city has a listing post in.
E.g. If the city Albany has listings in the Restaurants, Parks and Airports categories, I want the site structure to look like this:
USA->New York->Albany->Restaurants or
USA->New York->Albany->Parks or
USA->New York->Albany->Airports etc.
(We don't want to manually add Beaches, Restaurants etc. as a child taxonomy of destinations).
Is this possible to do using 1 CPT?
Or should we create 2 CPTs (one for all the places and another one for the listings?
Or should we use an entirely different method of organizing all this data?
An example of the URL format we are looking for is over here: https://www.trailforks.com/region/new-york/
(Click on the tabs on top, Overview, Areas, Trails, Routes etc. and see how there is a sub-page. Each State has these sub pages)
You can use 1 CPT for that structure. You also need to use the extension MB Relationships to create a relation between two taxonomy Destinations and Categories. In each term City, you can create connections to term Restaurants, Parks, Airports ...
Thank you, but I'm not sure I understand you.
How will this allow me to have a link structure like this:
Do I have to do anything besides add the relationship? Do I need to make this relationship on each post?
If you want to create the custom permalink structure like that, please refer to this topic https://stackoverflow.com/questions/41494883/show-only-specific-categories-in-permalinks-for-custom-post-type-in-wordpress/#answer-41654620