As per the get_pages() documentation:
‘child_of’
(int) Page ID to return child and grandchild pages of.‘parent’
(int) Page ID to return direct children of. Default -1, or no restriction.
So to get immediate children of a specific page, you would use the parent arg and not child_of.
$pages = get_pages( array(
'parent' => $pageID,
'sort_column' => 'menu_order',
) );
// Get the ID of the first child page.
$pageIDchild = ( ! empty( $pages ) )
? $pages[0]->ID : 0;
// Or to get all the IDs, you can do:
$all_ids = ( ! empty( $pages ) )
? wp_list_pluck( $pages, 'ID' ) : array();
Related Posts:
- WordPress get the child pages of current page
- is_child() function
- Drop-Down Menu of Current Child Pages
- Listing Child Pages in Random order
- How to display child pages with in a limited child content?
- A check for if is parent page, if has children, if has grandchildren
- Prev/Next child navigation for current page?
- Delete Child Posts
- Only allow new subpages to be created
- how to properly list child pages in sidebar?
- Get custom field value from Grandparent Page for Parent and Child Pages
- List the 5 most recent child pages
- Given the page id, check if it has children
- Multiple Conditions for Child Page Title
- How to get a list of all recently published child pages?
- get_children() not working properly – Only on one post?
- Set order of returned items in the WP_Query() class/function
- Show siblings (if any) and parents
- List child pages of current page but limit to specific year
- wp_insert_post if page doesn’t exist under current page
- Child page excerpt
- Display Child Pages of Custom Post Type Parent Page
- Create WordPress child page from page actions
- How to show child page without providing ID so it’s dynamic
- List all posts with the parent or grandparent of a page with a specified ID
- List of child custom post types lists all custom post types
- 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
- Adding title and description to subpage’s featured image
- Show list of Child Post in Parent Post
- List subpages in order
- Page to output sub-pages (children)
- How to use wp_list_pages on a grandparent page
- parent page grabbing wrong url for child pages – get_page_uri($pageChild)
- i want to get the parent id, only on parent -> child -> child page
- Search anything from a Child and Sub-Pages of their Parent page
- Only one parent page showing
- Child and Parent Pages list of sub pages
- Create a list of pages excluding children of selected page
- 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
- Displaying Child Page’s Information
- List child pages, exclude the current page
- Why does the first category returned get echoed twice?
- How to show the view more on my display of pages shortcode
- Display Tags of Child Pages
- Get post_meta of children and compare to current page ID
- Display the latest content from subpages of another page
- Get Child Custom Post Content on Single.php?
- Limit the number of child page displaying
- Show the grandmother/father of the childpage
- How to Hard Set the Parent Page in Template
- How can I structure my pseudo footer nav code with wordpress codex code?
- Website parent child relationship
- get_children() Not Working with orderby Parameter
- Display a list of child posts on parent posts of a custom post type
- Is there a default template file for child pages / subpages?
- Loop that displays PARENT PAGE & CHILD PAGE & outputs GRANDCHILD PAGE title and content
- How to order get_term_children output by alphabetic order
- Child pages on hierarchical Custom Post Types 404s
- Get threaded comments number
- Allow users to publish child pages of the pages they have access to edit
- How to get the excerpts of all children pages
- Query children and parent title
- Show only first children level of current category?
- List child pages of specific page using shortcode
- load common thank you template with different content for different pages
- How to Display child post on his parent post with thumbnail and content in WordPress
- Advanced or not so advanced pre_get_posts query
- Display child pages on parent page: 404 message overrules shortcode in page
- query pages by a childs publish date
- Organizing Your Pages
- Custom page template for multiple pages
- query if page has not child
- Return value of get_permalink(0) and get_the_title(0)
- How to have a custom URI path for specific page template
- Taxonomy Drill-Down / Plugin Help – hierarchical queries within plugin?
- complex get_posts() query to select child pages
- Page access only from a specific page in wordpress website
- (get_post_ancestors == 2) is returning true on 1 as well?
- Page that links to category content
- Sort get_children by menu_order
- Check is category parent with ids from the childs – get_term_children
- Exclude child pages args array
- Displaying Custom Taxonomy Children in Dropdown
- Show child by slug, while knowing parent ID
- Child Theme not overwriting Parent theme php file
- Creating navigation out of specific IDs and their children?
- List of child pages fetch next results at link click
- Showing main menu and child menu in diffent places in a same page
- WordPress list child pages of custom post type
- “Static” Child Menu with Accordian
- List CPT by menu_order with children right after parent
- List direct children of page
- List of pages – AJAX load more