I am currently trying to grab a child page id from a custom post type, but my values returned are always null. I know that the particular ID I'm passing has a parent so there should be a match.
What is the appropriate way to grab child ids using the parent id?
This is what I have tried:
$parentid = $order->get_id(); $args = array( 'post_parent' => $parentid, 'post_type' => 'shop_subscription' ); $child = new WP_Query($args); if ($child->have_posts()) : while ($child->have_posts()) : $child->the_post(); $childid = get_the_id(); endwhile; else: $childid = "not set"; endif;