//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);
//Display the list of IDs - for testing purposes.
//var_dump($string);
//Create a list of all pages excluding the list of child pages
wp_list_pages(array('exclude' => 'XXX,'.$string, 'title_li' => ''));
Related Posts:
- how to properly list child pages in sidebar?
- How to get a list of all recently published child pages?
- Show siblings (if any) and parents
- List child pages, exclude the current page
- Listing Child Pages in Random order
- Add class to the items in wp_list_pages
- Load parent pages when there are no child pages
- Exclude pages with certain template from wp_list_pages
- Get custom field value from Grandparent Page for Parent and Child Pages
- Given the page id, check if it has children
- inserting custom li class to wp_list_pages
- List child pages of specific page using shortcode
- WordPress get the child pages of current page
- How to get specified parent page title in my function
- List all-childpages on parent-page AND list child-pages on childpage itself but not the current one?
- List child pages by slug not ID?
- Menu with parents, children and or siblings pages display
- Append a code when at the current page in wp_list_pages()
- List child pages of current page but limit to specific year
- Child page excerpt
- Combine get_page_by_title to exclude pages from wp_list_pages
- Combining ‘depth’ with ‘include’ in wp_list_pages()
- Create WordPress child page from page actions
- How to show child page without providing ID so it’s dynamic
- is_child() function
- Exlude pages from wp_list_pages
- wp_list_pages() exclude category
- Drop-Down Menu of Current Child Pages
- Exclude pages by menu order
- Get WordPress Child Page IDs
- Displaying the first child page of the parent page
- Keep page hierarchy in wp_list_pages, even if on a child or grandchild
- Sort and display pages with specific custom field (not tag)
- Dynamic menu wp_list_pages displaying only current branch including: current page, his siblings and its childs
- Adding title and description to subpage’s featured image
- Show list of Child Post in Parent Post
- List subpages in order
- How to use wp_list_pages on a grandparent page
- parent page grabbing wrong url for child pages – get_page_uri($pageChild)
- Check if page has subpages
- i want to get the parent id, only on parent -> child -> child page
- Exclude child pages args array
- Disable the link on certain pages
- Get first level children of a page ID
- How to get an array of pages ID by some page’s slug and all its children pages in get_posts() function?
- Only one parent page showing
- Creating navigation out of specific IDs and their children?
- WordPress Betheme: Unkown subheader image of a child page
- How to disable alphabetical sorting page
- Structure for calling child pages
- Child pages and sub-pages do not appear. Why?
- Add link to parent page in list of child pages
- Display child pages full template including the content
- PHP: Why does my code work in index.php but not a widget?
- Exclude from wp_list_pages by template
- How to display child pages with in a limited child content?
- Why is wp_list_pages altering $post->ID of the page?
- Display Tags of Child Pages
- Get post_meta of children and compare to current page ID
- Get current post’s child page?
- How to make in post Parent page children page list nummbered
- Display the latest content from subpages of another page
- Limit the number of child page displaying
- Show the grandmother/father of the childpage
- How to Hard Set the Parent Page in Template
- Exclude pages by custom field (with yes/no) storing wrong data?
- Website parent child relationship
- Return parent post with its children using WP_Query?
- Show just one level of child pages, wp_list_pages woe
- Automatically create child pages when saving a (parent) page
- Allow only new sub-pages to be created
- Exclude certain category from latest updates
- Some pages are missing from the Parent Page select in the Editor
- Create child page within custom post type
- Remove parent slug for child pages
- Exclude Tags from get_the_tags
- Excludes posts that don’t have attachments in the_content()
- Easy way to process search results before displaying
- Excluding a category from next and previous post links
- Add exception for specific tag
- How to exclude categories from recent posts, recent comments & category widgets?
- How to exclude a directory from WordPress permalinks in a Multisite environment?
- select a private page as parent for another private page
- Deleted pages showing up when querying for child pages
- wp_list_pages(); Change output of hyperlink
- How to add numeric slug for child page in WordPress 5.9?
- I need ideas for a complicated menu
- list pages using page.php and NOT page-{slug}.php
- List all Posts under heading in wp_list_pages menu
- get permalink of page children in loop
- Child post with numeric only slug keeps redirecting to parent
- wp_list_pages to show all pages on all sub pages
- Next and Previous Posts of Same Parent
- Sort order of next/prev sibling page
- get_pages() & “child_of”
- How to target grandchild of post_parent using wp_list_pages
- What code should I use to display children of a custom post?
- Listing subpages title and content and styling the first iteration differently
- Listing Child Pages in a Certain Order?
- Add classes + taxonomy terms to wp_list_pages() output