I am looking to find a way to create a list of the IDs of children pages from a selected page.
My goal is to use the list of IDs so that I can exclude them from the following function:
wp_list_pages(array('exclude' => $###Children_Pages_to_be_excluded###, 'title_li' => ''));
I have checked the following question, but I am not sure how to use this function to achieve what I am trying to do.| Trying to list out child pages with WP_Query
I would appreciate any pointers. Many thanks for your assistance and time.
P.S.
I have managed to solve the problem with the following:
//Create an array containing the IDs of pages that are children of page ID XXX"
$args = array(
'post_type' => 'page',
'post_parent' => XXX,
'fields' => 'ids',
'posts_per_page' => -1,
);
$qry = new WP_Query($args);
//Convert the array into a string
$string = implode(', ', $qry->posts);
//Create a list of all pages
wp_list_pages(array('exclude' => $string, 'title_li' => ''));
wp_list_pages
or the exclude but still gives you the same result