You can use get_pages
with a limit of 1:
$pages = get_pages([
'child_of' => $post->post_parent,
'number' => 1,
]);
if ( $pages ) {
$first_page = current( $pages );
}
Related Posts:
- how to properly list child pages in sidebar?
- Get custom field value from Grandparent Page for Parent and Child Pages
- Given the page id, check if it has children
- How to get a list of all recently published child pages?
- WordPress get the child pages of current page
- Show siblings (if any) and parents
- List child pages of current page but limit to specific year
- Child page excerpt
- Create WordPress child page from page actions
- How to show child page without providing ID so it’s dynamic
- is_child() function
- Drop-Down Menu of Current Child Pages
- Get WordPress Child Page IDs
- Adding title and description to subpage’s featured image
- Show list of Child Post in Parent Post
- List subpages in order
- 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
- Get first level children of a page ID
- Only one parent page showing
- 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
- List child pages, exclude the current page
- Listing Child Pages in Random order
- How to display child pages with in a limited child content?
- 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
- Limit the number of child page displaying
- Show the grandmother/father of the childpage
- How to Hard Set the Parent Page in Template
- Create a “Dummy” parent page for a hierarchy in page listing?
- Allow only new sub-pages to be created
- Some pages are missing from the Parent Page select in the Editor
- Create child page within custom post type
- Custom Post Type Permalink For Parent/Child, 404 Page Not Found Error
- Remove parent slug for child pages
- Show content if parent page has children
- Easy way to process search results before displaying
- Only allow new subpages to be created
- Display posts of custom type in hierarchical order
- Load parent pages when there are no child pages
- Query in a Hierarchical Custom Post Type for Children vs Siblings
- Custom post type hierarchical permalinks not behaving as expected for parent/child pages
- select a private page as parent for another private page
- Deleted pages showing up when querying for child pages
- Add theme templates for child categories into the template hierarchy
- Can I make WordPress use a custom template for a child page
- meta_key & meta_value not working with get_pages and custom taxonomy
- WordPress pages with hierarchy
- Load child template based on parent
- Need wp_query to return all children and grandchildren
- How to get specified parent page title in my function
- Best way to give site sub-page it’s own domain?
- Child post with numeric only slug keeps redirecting to parent
- Verify if the current page has at least one published child
- Next and Previous Posts of Same Parent
- Child theme does not load all style
- Programmatically add existing pages and subpages to Appearance Menu
- Sort order of next/prev sibling page
- Versioned Custom Post Type (Not the same as revisions)
- Custom post Type, child of a Page?
- What code should I use to display children of a custom post?
- How do I Turn This Into An if statement?
- Installing plugins and using complex folder structure with child theme in WordPress
- Weird behaviour on Edit Menus screen
- Listing subpages title and content and styling the first iteration differently
- Listing Child Pages in a Certain Order?
- Redirect page to default subpage
- How to list a page tree?
- Exclude parent with child pages from WP_Query
- Query to get child pages of current page and display it in action hook
- Modify available templates (in dropdown)
- wp-query, pull children of parent page
- Page that links to category content
- How to control display of page lists on sidebar that doesn’t have childrens
- Exclude child pages args array
- Custom child page permalink
- Show child by slug, while knowing parent ID
- If page or sub page not working as expected
- Get top Page IDs from menu and cycle through their child pages on a scroller
- Paginate nested query of child posts
- My function echos only “array”
- WordPress Child Theme Template auth_redirect wrapper
- How to sort a sub-menu, generated with get_pages(), by the page order instead of alphabetically?
- Display inner pages like posts.[Like how post excerpt works]
- Children Pages Displaying Only Intermittenty
- Link to most recent child page
- Firing page_publish where page is child page
- Custom Post Type Child Pages
- How can I give WordPress child custom post type the same title and slug as its parent?
- displaying child pages in columns when on a parent page
- 404 on child page template
- Conditional sidebar menu
- Get Child Custom Post Content on Single.php?