get the sub pages of the parent page

I am using the following code to display the subpages pages of a parent page with id 67 , although it should return 3 pages but it is returning only two pages .

<?php
      $mypages = get_pages( array( 
       'child_of' => 67, 
        'sort_column' => 'post_modified',
        'sort_order' => 'desc', 
        'number'=>3
                     ) );
       echo count($mypages);                         
 ?>  

But when i don’t use the argument ‘number’=3, then everything is fine and it returns 3 pages. What is it that i am doing wrong.
Please help me

Related posts

Leave a Reply

1 comment

  1. try this one and check what your are getting.

    <?php
        $args = array(
            'sort_order' => 'ASC',
            'sort_column' => 'post_title',
            'hierarchical' => 1,
            'exclude' => '',
            'include' => '',
            'meta_key' => '',
            'meta_value' => '',
            'authors' => '',
            'child_of' => 0,
            'parent' => 67,
            'exclude_tree' => '',
            'number' => '',
            'offset' => 0,
            'post_type' => 'page',
            'post_status' => 'publish'
        );
        $pages = get_pages($args);
    
        print_r($pages);
    ?>