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?
- Check if is on child-page of a particular page
- Remove WordPress theme from a specific page
- Custom user role that can only edit specific (non-custom-type) page and all child pages [duplicate]
- How to display child term of current term’s parent taxonomy?
- Display child pages on a parent and child page using Featured Thumbnails
- How to get the top most term (top ancestor) of a custom taxonomy child term?
- How can I make wp_list_categories output li with category-slug as class, for its children?
- Can’t change parent page
- Javascript that will execute on only child pages of a specific parent
- What is the optimal way to filter out subpages from admin?
- Custom Field returning Numerical Value for Image rather than URL
- How to get all child pages in their parent page?
- remove/hide pages from users backend
- child of post type (custom)
- Menu with parents, children and or siblings pages display
- Taxonomies on custom taxonomies
- Category shows only top level child categories
- Can a user find a child page?
- Menu Arrow for Child Element
- How to Display Shortcode in the correct location, currently displaying before content after Page Title?
- WP_Query returns different results from get_posts() [closed]
- WordPress child pages not working
- How do I display child post types in the parent post type template
- If product is in sub-category show code
- Get all children titles of a page as a link to them
- Get list of all Grandchild Pages
- Can you exclude child pages of a specific parent within a navigation?
- Check if page has subpages
- Show subChild categories
- Return true if parent page id matches
- PHP: Why does my code work in index.php but not a widget?
- How to show children pages as array
- WordPress custom post type and page
- Display Child Page with custom fields within Parent Page
- 1st Level Page with No Children
- Display thumbnail of child, parent and ancestor using featured thumbnails
- How to accomplish a child page navigation?
- Get current post’s child page?
- Woocommerce – Making product pages child of shop
- get_children() returns ALL attachments instead only those attached to ‘post_parent’
- Subpages menu on sidebar plus widgets
- I have a website issue I am trying to resolve