I am currently constructing a page of custom post type and their children. The page needs the meta of the parent and also of the children. To build the HTML I first get all the parents and then loop through each parent, retrieve the children and their meta, and add this data to the object containing the parents.
This means that I'm making one database call to get all the parents and then another database call for each parent.
Is there a native way to do this in WordPress? A way that will output a single object? An object with each parent, its meta, its children and their meta?
And do this without having to make multiple database calls?