get_pages
does not work with posts or post types that is not hierarchical like pages, so if your post type is hierarchical like posts, it would not work
This function can also retrieve other post types using the ‘post_type’ parameter, but the type must be hierarchical like pages, or the function will return false.
If you need all post types to be returned, ie all post
, page
and custom post types, just pass any
to post_type
in either get_posts
or WP_Query
, the choice is up to you