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
- How can I clone/copy all fields (post and meta) from parent CPT post to child (with synced fields?)
- wp query to get child pages of current page
- Get the children of the parent category
- Get parent page url to show up when it is in child pages
- Custom Nav walker display current menu item children, or siblings on no children
- Get the first image from post content (eg.: hotlinked images)
- Check if is on child-page of a particular page
- Check if Current Category has Children
- Check if a post is in any child category of a parent category
- Can I have two child pages of different parents with the same name?
- How can I hide children of draft pages using wp_list_pages()?
- get_term_children for immediate children only (not grandchildren)
- Remove WordPress theme from a specific page
- Create a “Dummy” parent page for a hierarchy in page listing?
- get_children() Not Working with orderby Parameter
- How To Limit Hierarchical Pages Depth (For Custom Post Types) To Children Only
- Advanced Custom Fields – Get custom fields from parent page
- Exclude Child Posts from WP_Query
- How to make child categories recognize parent’s template displays
- Show just one level of child pages, wp_list_pages woe
- Automatically create child pages when saving a (parent) page
- Display a list of child posts on parent posts of a custom post type
- Allow only new sub-pages to be created
- 404 on child page when parent page slug is identical to custom post type
- Can I display submenus in groups, using wp_list_pages?
- Is there a default template file for child pages / subpages?
- Child Pages Loop
- Get Permalink for the top level parent of child pages
- How can I programmatically create “child” pages on theme activation?
- Custom user role that can only edit specific (non-custom-type) page and all child pages [duplicate]
- List child pages of a specific page
- Child terms from multiple parents?
- Keeping parent menu items active in child pages
- Some pages are missing from the Parent Page select in the Editor
- Create child page within custom post type
- Loop that displays PARENT PAGE & CHILD PAGE & outputs GRANDCHILD PAGE title and content
- Custom Post Type Permalink For Parent/Child, 404 Page Not Found Error
- Remove parent slug for child pages
- Check if post has children or not
- Show content if parent page has children
- How to display child term of current term’s parent taxonomy?