I'm struggling on querying posts in wordpress, precisely - i have a dropdown select field in visual composer widget and what i can select are IDs of parents of custom fields in custom post. To be more precise - i made custom post - cummunique - witch have custom field - regions - whitch is a list of checkboxes, and this custom field(regions) has subregions. It looks like this:
- SOME MAIN REGION
- some subregion
- some subregion
- ANOTHER MAIN REGION
- another subregion
- some sub sub region
- another subregion
- another subregion
Ofc wordpress admin can check some subregion only without checking main region and like i said in dropdown select of visual composer i can choose only main region id.
So when i choose from dropdown for example * SOME MAIN REGION i want to get only posts that have checked subregions that belongs to this main region.
- SOME MAIN REGION -> id is * some subregion parent id.
Is there a way that i can build meta_query to get these posts?
Thanks for any help!