How to Combine Two Custom Post Types into Single Permalink Structure

The website uses –

A) A hierarcical Custom Post Type “Destination” to support the following structure, so each tier of the hierarchy could have its own unique destination guide:

  • Territory – Americas
  • Continent – North America
  • Section –
  • Country – United States
  • Region –
  • State – New York
  • Area –
  • City – New York City
  • District – Manhattan
  • Neighborhood – Upper East Side

Resulting in the Upper West Side destination guide having 7 tiers and the URL:

site.com/destination/americas/north-america/united-states/new-york/new-york-city/manhattan/upper-east-side/

Note that each tier of the hierarchy is not required to be populated – a second example would be the destination guide for the Caribbean island of Dominica, which would only require four tiers:

  • Territory – Americas
  • Continent – North America
  • Section – Caribbean
  • Country – Dominica
  • Region –
  • State –
  • Area –
  • City –
  • District –
  • Neighborhood –

The URL for the Dominica destination guide would be:

site.com/destination/americas/north-america/caribbean/dominica/

No issues here – that part works fine. Here is the challenge –

B) Each individual destination has a variety of unique features that have their own respective Custom Post Type:

  1. Hotels
  2. Restaurants
  3. Bars
  4. Attractions
  5. Tours
  6. etc.

These Custom Post Types are not hierarchical, but must be related to the appropriate page (tier) of a Destination Custom Post Type.

To provide logical consistency between the site architecture, permalink structure, breadcrumbs and menus, each of these Custom Post Types should be listed under a specific destination.

The various Custom Post Types for these destination features are simple and not hierarchical.

Hotel Example:
An individual hotel would have a simplistic hotel/hotel-name structure, but always be associated with a parent destination.

As a result, the Permalink for The Lowell Hotel on New York’s Upper East Side would be:

site.com/destination/americas/north-america/united-states/new-york/new-york-city/manhattan/upper-east-side/hotel/the-lowell/

In Dominca, the hotel Permalink/URL would be:

site.com/destination/americas/north-america/caribbean/dominica/hotel/rosalie-bay-resort/

Restaurant Example:
The same approach would hold true for a restaurant, in this case, the Serafina Restaurant:

site.com/destination/americas/north-america/united-states/new-york/new-york-city/manhattan/upper-east-side/restaurant/serafina/

Again, for Dominca, a restaurant Permalink/URL would be:

site.com/destination/americas/north-america/caribbean/dominica/restaurant/romance-cafe/

By using this approach, a number of taxonomies may be added to query/filter, for example, four-star, resort hotels, under 250 rooms, with guest ratings over 7/10, with the Destination (and its child destinations) defining the eligible properties.

Ideally, would like to deal with this using rewrite rules to subordinate the otel, Restaurant, etc. Custom Post Types under the Destination Custom post type.

Have tried it a number of ways with no success. Any suggestions? Examples would be much appreciated.

0

Leave a Comment