i am using that code to get all parent pages, all pages are top level. I am looking to exclude those pages which have not child pages.
<?php
$my_query = new WP_Query(array(
'order' => 'ASC',
'orderby' => 'menu_order',
'post_parent' => 0,
'post_type' => 'page',
));
if ($my_query - > have_posts()) {
while ($my_query - > have_posts()) {
$my_query - > the_post();
echo get_the_ID().
"<br>";
}
}
?>