I’m using “Ultimate Post Type Manager” (https://www.ads-software.com/plugins/ultimate-post-type-manager/) for creating the custom types:
directorio (Directory)
dire_pais (Country)
dire_estado (State)
dire_municipio (City)
dire_pais, dire_estado and dire_municipio custom types are related to “directorio” using related custom fields created with “Advanced Custom Fields” plugin (https://www.ads-software.com/plugins/advanced-custom-fields/)
The custom fields are:
meta_key name: pais, type: relation, post_type: dire_pais
meta_key name: estado, type: relation, post_type: dire_estado
meta_key name: municipio, type: relation, post_type: dire_municipio