sort by "include" id's for get_pages
I'm using get_pages function to create a list of pages and passing an array of ordered page ID's for "include" parameter, but WP does not respect the order of the array. I was expecting this to be default behavior of WP.
Could an option be added to this function so WP would output pages by the order you give it for the include option?
wp_list_pages does not support that either.
To make it work I used a for loop and used "get_page($id)" function for each of the pages to ensure they show up in the right order.
When you do a query like this:
$pages = get_pages( array( 'include' => array( 10, 2, 5 ) ) );
shouldn't it return an array of pages where "10" ID comes first and 2 comes after that, and the pages with the 5 ID would be the last?
No, that just says 'Get pages 10, 2, and 5', it doesn't force the order.
RSS feed for this topic
You must log in to post.