Get first level children of a page ID

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();