1

I'm trying to replicate the geographical region-country structure of the site United Nations. As you can see this is the structure

  1. Africa (geo_region parent):
    • Eastern Africa (geo_region child)
      • Burundi (geo_country parent)
      • Comoros (geo_country parent)
    • Middle Africa (geo_region child)
      • Angola
      • Cameroon
  2. Americas (geo_region parent)
    • Latin America and the Caribbean (geo_region child)
      • Caribbean (geo_region child)
        • Anguilla (geo_country parent)
        • Bahamas (geo_country parent)

My idea is to separate regions and countries in two different taxonomies (geo_region, geo_contry) like above.

At this point everything is ok.

Now my issue is make a relationship between geo_country and geo_region. For example I would like to create a relationship between Bahamas and Caribbean with ID.

I used ACF relationship field but the main problem is that i use the wp-json REST API and when i visit the taxonomy endpoint there is no relationship.

How i can solve this? Is there a better way to do this?

Thanks in advice Alessio

1 Answer 1

0

Make the countries a custom post type, set up taxonomies for continents (region parent) and the regions. Maybe you can even use just one taxonomy for both, but there is )was?) this weird case in WP, where it sees a difference between just child selected and child and parent selected.

That setup makes you independent from any plugin – you really, really don't want a dependency on ACF in your database, trust me. :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.