Do not show child pages of child pages

You can do that with using the depth argument. I also created an array of your arguments for better readability.

The depth argument accepts the following parameters:

‘depth’
(int) Number of levels in the hierarchy of pages to include in the generated list. Accepts -1 (any depth), 0 (all pages), 1 (top-level pages only), and n (pages to the given n depth). Default 0.

So, as you want to display the first children, you need to set it to 2, if you want the next level included, set it to three. 1 gives you toplevel ($parent == 0) only.

$args = array(

    'sort_column' => 'menu_order',
    'title_li'    => '',
    'child_of'    => $parent,
    'echo'        => 0,
    'depth'       => 2 

);
$childpages = wp_list_pages( $args );

Leave a Comment