I have an hierarchical custom post type called Geographies, wherein each Geography is assigned to a custom taxonomy (
geographytype): Area, Country, Region or City. The hierarchy is set as follows:
Area ¬ Country ¬ Region City
As an example: The city of Boston is a child of United States, which in turn is a child of Americas.
I want to be able to get children and/or grandchildren of a Geography, and specify its
geographytype - for example, if I'm viewing Americas, I want to get all the cities, including Boston.
However, it seems like I can only do one or the other. If I use get_pages(), I can get all children and grandchildren by specifying the
parent parameter, but I can't specify a
geographytype, so I just get everything.
Conversely, if I use WP_Query() I can specify my
geographytype using the
tax_query parameter, but it won't give me grandchildren; I can only get direct children using the
I want to be able to do both: get children and grandchildren, with a specified custom taxonomy.